Forum Moderators: phranque
I used to use a .php file which was requested like
http://example.com/index.php?content=xyz or
http://example.com/?content=xyz
Now, I'm using a simple .htm-file instead of the PHP-Script.
I don't want it to look like duplicate-content for search engines. That's why I want to redirect such requests with 301, moved permanently: http://example.com without any parameters.
Howto do that?
Thanks in advance.
The best place to start finding information is in the library - link is at the top left of pages. When you have something you have tried and cannot get to work, let us know and we will be glad to help you.
You will need to use QUERY_STRING to prevent an infinite loop. EG
RewriteCond %{QUERY_STRING} .
RewriteRule ^(index\.php)?$ http://yoursite.com [R=301,L]
Justin
Add a trailing slash to the substitution URL to save your server a bit of work:
RewriteCond %{QUERY_STRING} .
RewriteRule ^(index\.php)?$ http://yoursite.com/ [R=301,L]