4
votes
Accepted
seo friendly url not working
...my .htaccess file which lives in the distributor folder
RewriteRule ^distributor/([0-9]+)$ distributor/index.php?id=$1
If the .htaccess file is actually inside the /distributor directory then you ...
- 12.1k
3
votes
Apache mod_speling re-writing all URLs to lowercase
You could use mod_rewrite to rewrite all your requests to lowercase. That might look like:
RewriteEngine On
RewriteMap lc int:tolower
RewriteRule ^(.*) ${lc:$1}
Given these files on disk:
$ ls
file1....
- 42.8k
3
votes
Accepted
Different limit_req for $request_uri part
According to the limit_req_zone directive documentation:
Requests with an empty key value are not accounted.
So just use two limit_req directives in your PHP handler location and made one of the ...
- 2,616
2
votes
seo friendly url not working
Your RewriteRule matches only numbers, that is, distributor/3728 etc. It does not match abcinc.
From the id argument passed to index.php it looks like your application expects an ID here and not a ...
- 36.1k
2
votes
Accepted
Force https on all website except one on IIS
Change condition to doesn't match your excluded site:
or
Add another rule before existing - match your excluded site, action=none and stop processing:
- 576
1
vote
Accepted
Nginx http to http redirect 400 The plain HTTP request was sent to HTTPS port
Issue fixed, happened that there was another config file that had port 80 listening on ssl which was causing the error
server {
listen 80 ssl;
listen [::]:80 ssl;
server_name another-app1....
- 503
1
vote
NGINX Crossed Mappings
$username variable is not defined here, that is one issue at least.
Otherwise I don't see why this configuration would do the effect you are describing.
With the rules above GET /user/1234/ is ...
- 36.1k
1
vote
Accepted
nginx append query parameter to a react application
If you want React to see the query parameter you will need to use redirect or permanent. The other modes of rewrite are internal to Nginx. See the rewrite documentation.
To protect against a ...
- 12.4k
1
vote
Accepted
Nginx - fastcgi cache not working for rewrite enabled php page
Your location = /inc/special.php passes requests directly to fastcgi server, therefore there is no caching.
Furthermore, you need to check the HTTP caching headers set by special.php. If the HTTP ...
- 36.1k
1
vote
What is the difference between Nginx variables $host, $http_host, and $server_name?
$http_host
$http_host always equals Host request header field
Host: example.org
$host
$host is in this order of precedence (from high to low):
Host name from the request line
GET http://example.org/...
- 311
1
vote
What is the difference between Nginx variables $host, $http_host, and $server_name?
TL;DR: If you don't use regular expressions in server_name you can ignore this answer 😉.
Since this aspect hasn't been mentioned at all in other answers, but it's something that I found somewhat ...
- 1,496
1
vote
Accepted
Blocking Port 8080 from direct IP access but allow access via domain (Virtualhost Config)
Since you are reverse proxying to localhost:8080, there is probably some application server other than Apache listening on port 8080. You cannot control that other software by adding VirtualHost ...
- 44.8k
1
vote
Accepted
Is it possible to access a modified query string in a RewriteCond *after* applying a RewriteRule?
Ok, I found a simple solution myself:
RewriteCond %{QUERY_STRING} ^()id=([^&]+)(.*)$ [NC,OR]
RewriteCond \?%{QUERY_STRING} ^(\?.*)&id=([^&]+)(.*)$ [NC]
RewriteRule ^/app\.jsp$ /...
- 111
1
vote
Regex to remove certain patterns from urls
If all your URIs should match the pattern you given (two letter prefix before the locale part):
rewrite "^(/\w{2})/en-(?:us|gb)(/.*)" $1$2 permanent;
(regex pattern should be quoted due to ...
- 2,616
1
vote
Accepted
On Apache how to switch off DirectorySlash only for requests to a specific subdomain?
By the sounds of it, your sub subdomain maps to the same directory as the main domain and all other subdomains (www and other, etc.)
However, if all requests to the sub subdomain are internally ...
- 12.1k
1
vote
My IIS URL Rewrite rule is not working for my IIS website
Try this - set a DNS entry for both "url domains" to point to localhost, or a hosts file entry. 127.0.0.1 astro.res... and next line same with astronomyteams.org . then find out why we had ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
rewrite × 2105nginx × 916
apache-2.2 × 393
mod-rewrite × 363
.htaccess × 312
iis × 226
redirect × 206
url × 150
apache-2.4 × 111
reverse-proxy × 106
iis-7 × 92
php × 75
regex × 66
wordpress × 56
rewritecond × 56
proxy × 55
301-redirect × 50
iis-7.5 × 46
virtualhost × 39
https × 39
apache2 × 38
linux × 34
ssl × 34
subdomain × 34
php-fpm × 33