Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ngx-http-rewrite-module]

nginx rewrite module is a default module that implements if-statements, rewrite directives and allows URL manipulation in nginx with the help of PCRE regular expressions (it's what mod_rewrite is to Apache)

0
votes
0answers
7 views

How to use nginx to service a simple GET request (identify the path parameters and use it to replace text in a file, and then return it)?

This is rather challenging. I'm trying to use nginx to service a simple GET request just like a web application server. Problem: I have a file situated from the web root path at: /group/catetory/...
0
votes
1answer
13 views

nginx rewrite based on part of URL

I'm trying to set up nginx rewrites; I have it successfully set up to remove the extension: https://example.com/accounts?id=user-123 points to https://example.com/accounts.php?id=user-123 using just ...
-1
votes
0answers
29 views

Nginx rewrite and proxy_pass can't find object

For our project, we use RabbitMQ and also show the information via nginx but nginx can't show the queue information: http://domain:15672/#/queues/%2Ftest/%2Fnode_processor # works http://domain:9000/...
1
vote
0answers
47 views

Nginx: how to rewrite HTTP_HOST keeping the original URL unchanged

A bit of background: When abc.mywebsite.com (or xyz.mywebsite.com and so on) is requested, it received by haproxy, which replaces the Host header with main.company.net and also adds the X-Custom-...
0
votes
1answer
57 views

Nginx caching reverse proxy with URL rewrite

I am serving large static files from a backend storage server with slow spinning disks. This server is hidden behind fast nginx reverse proxy with local cache on SSD. It works great and fast. Now I ...
0
votes
1answer
123 views

How to redirect all requests except when there's an exact string match

Requirement- I want to redirect all requests that end with /abcd to /products/abcd This should match all urls such as these- /collection/abcd /collections/all/abcd /hello/world/abcd This is what i'...
0
votes
1answer
60 views

Nginx Node Proxypass Result to Variable

I want create some rewrite with nginx (5 million links), I read nginx have the option to save it in a map file but need ages to reload + ram usage when I do it this way. My Idea was now User -> ...
0
votes
1answer
65 views

port RewriteRule from apache to nginx

we have a large php application running on apache now which I would like to migrate to nginx. I’ve got everything to work correctly except for a RewriteRule in a .htaccess file. The web app allows ...
0
votes
1answer
76 views

PHP script path inconsistencies on nginx with multiple server root paths

I'm struggling a bit with some nginx configuration. Essentially I have one filesystem folder (/remote) that hosts web content at /, but on top of this I want virtual paths /w and /wiki that will host ...
1
vote
0answers
214 views

nginx rewrite error, invalid number of arguments

I'm running nginx 1.13.6. The configuration has this directive to serve a virtual host service.company.com/ using service.company.com/svc/: if ($server_name = service.company.com) { rewrite ^(.*)$ ...
0
votes
2answers
270 views

nginx rewrite : [emerg] unknown “0” variable

1.) Apache Rule: RewriteRule ^(.*)/(.*).htm$ /inner.php?Categories=$0&Title=$1 [L,QSA] 2.) After converting to nginx: rewrite ^/(.*)/(.*).htm$ /inner.php?Categories=$0&Title=$1 break; ...
1
vote
2answers
409 views

Finish processing rewrite directives in location and return 301

I have the following in my nginx.conf: location ~* /collections.*?products/([^/]+)/?$ { rewrite ^/collections.*?products/([^/]+)/?$ /$1.html; rewrite ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3; ...
0
votes
2answers
4k views

nginx reverse proxy with query parameter modification

I have an application that is not SSL aware behind nginx, thus I need to do the following http://example.com/f1/f2/page?next_page=http%3A//example.com/f3/new_page has to change to https://example....
0
votes
0answers
58 views

NGINX rewrite works on test server but not on production server

I have the following in my nginx location file: location = / { rewrite / /landing redirect; } location /landing { root /opt/deploy; rewrite ^/landing/resources/(.*) /landing/resources....
0
votes
1answer
74 views

converting htaccess url rewriting rules into nginx

How can i convert my htaccess rules here RewriteRule ^/?([^/]+)/([^/]+)/?$ page-1.php?a=$1&b=$2 [L,QSA] RewriteRule ^/?([^/]+)/([^/]+)/([^/]+)/?$ page-2.php?a=$1&b=$2&c=$3 [L,QSA] into ...
0
votes
1answer
27 views

How do I rewrite these URL's?

I'm working on an ancient (1989!) website which, back in the days, just showed a file directory in some cases. I want to use rewrites to show people a proper file instead. Case: I have 3 folders, 01, ...
1
vote
1answer
998 views

rewrite or internal redirection cycle while internally redirecting to, in nginx

I'm trying to get a rewrite rule to work for nginx and Wordpress. After a reboot of nginx, I try the site and get an IS 500 error page. The log file says: *1 rewrite or internal redirection cycle ...
1
vote
1answer
36 views

Ngnix static site with one PHP alias/rewrite

I have a static site Angular site and I want to have the path /deploy run a php the php script /var/www/app/deploy/deploy.php. I have tried a rewrite rule and having no luck. What is the proper way ...
0
votes
1answer
235 views

Double rewrite request

I have nginx and I trying create rule in the double condition (if) and double rewrite. The schema is: URL (/direct/file.11223344_aabbcc.js) -> if no file -> [Yes] rewrite to /direct/file_aabbcc.js -> ...
1
vote
1answer
826 views

add a URL suffix path (for mobile AMP) without causing a redirect loop in nginx

i am using nginx web server for my wordpress website. i am going to make it to become amp version for mobile serve. i wanna add /amp/ to my url. i also using pretty permalink for my current url,so ...