New answers tagged


server { listen 80; listen 443 ssl; server_name; ssl on; ssl_certificate /var/www/; ssl_certificate_key /var/www/; access_log /var/log/nginx/ rt_cache; error_log /var/log/nginx/


for the just the home page and nothing else, i would use: location / { rewrite ^/$ /blog/ redirect; } anything else, like /foo/ would not be redirected to /blog/ .


I bumped into the same issue when trying to setup NGINX to serve WebP files from the same filename as JPG/PNG's and certain files were containing spaces. The reason why it happens like this is: space cannot be used inside of an URL and browsers replace it automatically inside the URL with %20, as you might be aware​ the $uri variable in this case will ...


RewriteCond %{HTTP_HOST} (^www.)?$ [NC] RewriteRule ^(.*)$$1 [R=301,L] Which works with point #2 But the "problem" with this is that it redirects everything, not just /about-us, which is what you've stated as the requirements for point #2. (^www.)?$ - You've put the start-of-string anchor (^) ...

Top 50 recent answers are included