SEO gone mad...

Aleksandar Lazic al-nginx at none.at
Mon Oct 12 21:19:28 UTC 2015


Hi steve.

Am 12-10-2015 21:59, schrieb steve:
> Hi folks,
> 
> I have a requirement from a customer that the terminal slash be
> rewritten when accessing the homepage - eg example.com/ is a 301 to
> example.com

But the solution below will not work due to the fact that most browser 
add a trailing / if there is none.
Mybe the customer want to redirect to a 'index-page'?

e.g.: index.php, index.do or to a *_pass?

> I've tried a simple rewrite of ^/$ but that just loops.
> 
> Any ideas?

http://nginx.org/en/docs/http/request_processing.html
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return

location = / {
     # this will work for curl but for browsers?!
     return 301 http://example.com;
}


BR
Aleks



More information about the nginx mailing list