dubstep
November 7, 2011, 6:34am
#1
Developing static files on the local filesystem I use index.html instead
of / for the home page.
When I push them to the remote server I want
http://domain.com/index.html to be redirected to http://domain.com/ for
SEO reasons.
I’ve Googled but the best I seem to be able to achieve is a redirect
loop. What do I need to do?
Here are my failed rules :
rewrite ^index.html$ $scheme://domain.com/ permanent;
rewrite /index.html $scheme://domain.com/ permanent;
location = /index.html {
rewrite ^(.*) $scheme://domain.com/ permanent;
}
Thanks.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,217899,217899#msg-217899
mark
November 7, 2011, 8:25am
#2
On Mon, Nov 07, 2011 at 12:34:13AM -0500, Mark wrote:
rewrite ^index.html$ $scheme://domain.com/ permanent;
rewrite /index.html $scheme://domain.com/ permanent;
location = /index.html {
rewrite ^(.*) $scheme://domain.com/ permanent;
}
Thanks.
Either
location = / {
try_files /index.html =404;
}
location = /index.html {
internal;
error_page 404 =301 $scheme://domain.com/;
}
or
location = / {
index index.html;
}
location = /index.html {
internal;
error_page 404 =301 $scheme://domain.com/;
}
–
Igor S.
mark
November 7, 2011, 12:33pm
#3
Perfect!
Many thanks.
Спасибо большое.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,217899,217915#msg-217915