I'm having an issue where if a user types:
www.myurl.com/page.html
they are redirected first to
myurl.com/page.html
and then to
myurl.com/page
This is because I have the following in my conf file
#remove www from url
if ($host ~* ^www\.(.*)) {
set $remove_www $1;
rewrite ^(.*)$ http://$remove_www$1 permanent;
}
location /{
# removes .html extension
if ($request_uri ~ \.html($|\?)) {
rewrite ^(.+)\.html$ $1 permanent;
}
}
My question:
Is there a way to eliminate the the first redirect so that if a users types www.mysite.com/page.html
they are redirected straight to mysite.com/page