Nginx: How To Redirect /index.php To / To Avoid Content Duplication
By Angsuman Chakraborty, Gaea News NetworkFriday, August 8, 2008
Normally any website that responds to /index.php also responds to /. This has the potential to duplicate content. So how can you re-direct /index.php to / without causing infinite loop in nginx?
Here is a simple solution:
if ($request_uri ~* "^/index.php\??$") { rewrite ^.*$ https://$host? permanent; }
It redirects any url with /index.php or /index.php? at the end. However it doesn’t prevent internal re-direction to index.php as is normal with most PHP based web software.
Tags: nginx
Louis Vuitton handbags |
purab |
August 13, 2009: 12:15 pm
if ($request_uri ~* “^/index.php\??$”) { This code is useful when all requests are going to index.php. I am looking for removing ending slash from subfolders of website. |
May 2, 2009: 7:56 pm
With mod_rewrite you can do this: RewriteEngine On see https://blog.blacknode.net/2009/05/redirect-indexphp-to-root-of-current-directory/ |
April 29, 2009: 4:04 am
Thank you for the tip You’ve inspired me to bring my .htaccess file up to speed. |
August 23, 2008: 6:45 am
Thanks for this tutorial. I had been wondering how to do that until i read this. |
güzel sözler