Reputation: 175
I have a site where I have some links like this: http://mysite.com/search-RANDOM_WORDS.htm
The problem is that Google tries to index links like:
http://mysite.com/search-RANDOM_WORDS.htm/existing-link-on-the-site
http://mysite.com/search-WORD.htm/link-on-the-site/search-ANOTHER_WORD.htm
etc. etc. The site doesn't use subfolders in links, every link is on the root. I don't really understand from where Google is taking these links through, but I have to fix it somehow. I am using mod_rewrite already, but I did not found yet a working solution for my problem. It should work like this:
How can be done this? Thanks!
Upvotes: 1
Views: 374
Reputation: 785481
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(search-.+?\.htm)/.*$ /$1 [L,R=301,NC]
Upvotes: 1