> Can the catch-all virtual host redirect with 301 instead of 302? I got this one: adding "permanent" after the rewrite directive... Sorry.by ez77 - Nginx Mailing List - English
Another thought... Can the catch-all virtual host redirect with 301 instead of 302? The less elegant solution employed 301. Thanks!by ez77 - Nginx Mailing List - English
Thank you, Igor. I have cleaned up my subdomain redirection the way it should be. Moreover, your instructions for "dir/index.html -> dir/" work under version 0.8.50. As the whole point of my pet peeve was to have unique, canonical URLs for every document, I found it surprising that now URLs such as .../dir are not automatically rewritten (301) as .../dir/ . I know I'm a royal painby ez77 - Nginx Mailing List - English
> In this configuration: > > rewrite ^(.*/)index.html http://$host$1 permanent; > > location / { > index index.html; > } > > nginx will not run the server level rewrite, after the internal redrect, > so there will not be the loop.In this configuration: > > rewrite ^(.*/)index.html http://$host$1 permanent;> > > location / { > indeby ez77 - Nginx Mailing List - English
> Location / would also work although server is probably better Must I include an if clause? I still get a redirect loop without one.by ez77 - Nginx Mailing List - English
> rewrite ^(.*/)index.html http://$host$1 permanent; Hi Mat, I like your proposal better, which looks more elegant without the if clause, but I don't know where to include it. Under location / I get a redirect loop. Thanks, Ezequielby ez77 - Nginx Mailing List - English
> At the risk of pushing it... is there a way to make the redirect 301 rather than 302? In case anybody is interested, the following code (very similar to the original I found elsewhere) works OK in the latest version, 0.8.50, with a 301 response: location / { root /var/www/mysite; index index.html index.htm; if ($request_uri ~ (.*/)index.htby ez77 - Nginx Mailing List - English
> Upgrade to the lastest 0.8.50 and try > > location ~ ^(?<DIR>.*/)index.html$ { > internal; > root /var/www/mysite; > error_page 404 http://$host$DIR; > } Nice! It worked! Thank you very much, once again. At the risk of pushing it... is there a way to make the redirect 301 rather than 302? Cheers, Ezequielby ez77 - Nginx Mailing List - English
Thank you all for your replies. It's indeed an honor to receive help from the very creator of nginx! Not meaning to bug any of you any more... but this last configuration, location / { root /var/www/mysite; index index.html; } location ~ ^(/.+/)index.html$ { internal; error_page 404 http://$host$1?; } , redirects to the root of my site: site.com/ instead of site.com/dir/. To be precby ez77 - Nginx Mailing List - English
Greetings, I'm trying to send all .../dir/index.html requests to .../dir/ . I looked this up in forums but I'm only able to do it for the root directory: location / { root /var/www/mysite; index index.html index.htm; if ($request_uri = /index.html) { rewrite ^ http://$host? permanent; } } Some day I'll try to stop this copy-and-paste madness, but "by ez77 - Nginx Mailing List - English