Skip to main content

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
0 answers
45 views

I cannot change my URL e.g. /dfdrgr.php?page=dfgfg to /rrrr. I’ve a .txt file contained e.g. /rrrr /dfdrgr.php?page=dfgfg; and a redirected.map file contained: # Redirects map file – auto generated ...
Roh's user avatar
  • 101
0 votes
1 answer
131 views

How to configure NGINX virtual host (vhost) to serve the same image (/images/game-board.png) for all image requests that start with a specific string like /images/game-board-? Example: For these image ...
Raghavendra N's user avatar
0 votes
0 answers
181 views

I have lots of image files without an extension (no .png, .jpg, .etc) in the Wordpress uploads folder (/wp-content/uploads/2024/). These do appear in articles and are used, but due to the missing ...
Johnny Bravo's user avatar
0 votes
1 answer
384 views

I want to check if a parameter is present in a url in nginx and then rewrite. How can i do that? For e.g if url is http://website.com/search/node/item123/loc=33 then redirect to http://website.com/...
Bijan Zand's user avatar
1 vote
1 answer
397 views

I have an API endpoint like /my/api/PARAM1/abcd?arg1=val1&arg2=val2, and use a redirect to proxy to a fastcgi server elsewhere (using upstream). Basically I have the current configuration : ...
fred59xc06's user avatar
0 votes
0 answers
450 views

My script is hosted on centos 7 apache server, with below htaccess: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> ...
ktiwari's user avatar
1 vote
0 answers
259 views

I need a quite special rewrite rule but I can’t find the way to do it. I need to map a uri to a regex to a replacement string built with a regex. For example I have a /pdv/plan-AGE44-ABC.pdf uri that ...
Olivier THIERRY's user avatar
1 vote
1 answer
478 views

I'm having to rewrite URLs in nginx.conf that contain particular query parameters; As an example:- location /brands/exampleA { if ($arg_cat = "9") { return 301 /page/brand-...
zigojacko's user avatar
  • 1,483
0 votes
0 answers
207 views

I am trying to block PHP script execution in few folders for a WordPress installation but Nginx is giving me hard time. location = /wp/wp-includes/category.php { deny all; } I am able to block ...
Maximus's user avatar
  • 365
1 vote
0 answers
5k views

When using nginx and maps it is possible to rewrite mutiple URL's with a map file. What is problematic is when the URL contains special characters. I have been breaking my head trying to get this ...
Adesso's user avatar
  • 203
2 votes
1 answer
539 views

I hope that someone can help me here as I have very limited knowledge about server related stuff. I have a WordPress site where I want to limit the /wp-content/uploads/ directory access to logged in ...
bakar's user avatar
  • 21
1 vote
0 answers
133 views

WordPress installed in a subdirectory: domain.com/folder WordPress Permalink Settings: domain.com/folder/%postname% Referencing the WordPress Nginx support article, I added the following to my nginx ...
webdev's user avatar
  • 11
2 votes
1 answer
463 views

So, I am actually trying to port the RewriteRules from Apache to NGINX but it seems I am not able to completely port out. Actually, on my server I do have a running site on https://example.com domain ...
NoobAvi's user avatar
  • 23
1 vote
1 answer
590 views

I have an unknown number of domains that match a pattern like www.abc123.example.com. Where the number after "abc" is unknown. I thought perhaps I could use a rewrite rule with the regex ~*(...
LK86's user avatar
  • 55
1 vote
2 answers
1k views

I have following location with rewrite: location ~ ^/payment/gateway/v2/order/complete/(.*)$ { proxy_pass http://api.test.com:8080/payment/gateway/v2/order/complete?order_id=$1; } then I tried ...
SBotirov's user avatar
0 votes
2 answers
1k views

Given a location like this: location ~ ^/user-content/img/) { root /srv/foo/bar/uploads/; autoindex off; access_log off; expires 30d; } Is it possible using nginx to have a request for /user-...
Oliver Weichhold's user avatar
0 votes
0 answers
64 views

I'm having trouble rewriting this URL below: https://domain-name.com/2020/10/title_of_article.html?id=1 into: https://domain-name.com/0/1 the year is unnecessary so it is removed/truncated/ignored ...
ikevin8me's user avatar
  • 137
0 votes
2 answers
5k views

I know there are Nginx phases. Why does the following snippet deliver the "200 Host: example.com" instead of forwarding to Google? What would be a generally valid workaround to evaluate Lua ...
uav's user avatar
  • 624
1 vote
1 answer
685 views

Hi there anyone happens to know Nginx rewrite rules? I'm trying to convert this Apache .htaccess to Nginx Rewrite, I already tried with online converters the homepage and dashboard once logged in work ...
Elin Digente's user avatar
0 votes
1 answer
2k views

I have a domain and wildcard subdomains. main domain: example.com subdomains: s1.example.com, s2.example.com etc. Now the requirements is s1.example.com will be redirect to example.com/organization/...
Rakibul Hasan's user avatar
0 votes
0 answers
635 views

I found excellent rewrite rules and a PHP script that works with Apache to count the number of downloads for certain file types. I need this converted to be NGINX friendly. The Apache rewrite rules ...
Eugene van der Merwe's user avatar
1 vote
2 answers
4k views

Recently we have moved to Nginx from Apache, Under apache it used to be very easy just put some stuff on .htaccess and done. RewriteEngine on RewriteBase / # only rewrite if the requested file doesn'...
HelenSaepp's user avatar
1 vote
2 answers
1k views

I'm using this .htaccess that pass everything after URL to $param, so example.com/news/id goes to PHP as $_GET['param']='news/id'. But Nginx is always throwing me to 404 page. My .htaccess: ...
Sandro Benevides's user avatar
1 vote
0 answers
3k views

I recently was given the task of setting up a proxy and everything works great now, except that I can't seem to filter basic urls with sub_filter. This code works flawlessly sub_filter 'anna' 'bob'; ...
reschandreas's user avatar
1 vote
1 answer
1k views

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 ...
ieatpizza's user avatar
  • 113
1 vote
0 answers
1k views

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-...
MacUsers's user avatar
  • 489
1 vote
2 answers
2k views

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 ...
BarsMonster's user avatar
0 votes
1 answer
996 views

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'm ...
Mridul Aggarwal's user avatar
0 votes
1 answer
152 views

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 -> ...
StefanBD's user avatar
  • 101
0 votes
1 answer
124 views

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 ...
dingenling's user avatar
0 votes
1 answer
417 views

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 ...
Malvineous's user avatar
  • 1,275
1 vote
0 answers
1k views

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 ^(.*)$ ...
Potatoswatter's user avatar
0 votes
2 answers
758 views

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; ...
user3136863's user avatar
2 votes
2 answers
1k views

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

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....
Vince's user avatar
  • 51
0 votes
1 answer
131 views

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 ...
Axon's user avatar
  • 3
0 votes
1 answer
56 views

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, ...
Evert's user avatar
  • 162
1 vote
1 answer
9k views

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 ...
Andrew Newby's user avatar
  • 1,224
1 vote
1 answer
57 views

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 ...
Raymond's user avatar
  • 11
0 votes
1 answer
631 views

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 -> ...
Piknik's user avatar
  • 53
1 vote
1 answer
2k views

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 ...
JohnsonGoey's user avatar