Forum Moderators: phranque
Current .htaccess for xyz.com
RewriteEngine ON
RewriteRule (.*) [abc.com...] [R=301,L]
The .htaccess file works, but it is creating a lot of duplicate links in the search engines by appending the thread or post idea to the redirect. For example...
Old domain Google link...
www.xyz.com/phpbb/viewtopic.php?p=1399
New domain Google link...
www.abc.com/?p=1399
I would like to have the redirect remove the appended thread and post ideas so those indexes would eventually be removed.
Thanks,
B
See the 4th rule in message #2 of this recent thread [webmasterworld.com]. You'll need to modify the query string test to only look for blank vs. non-blank (a regex pattern of "." will suffice) and change the URLs, of course, but the basic idea is what's needed.
Jim
New domain links in the search engines that were indexed as a result of the rewrite appear as...
www.abc.com/?p=1399
or
www.abc.com/?t=412
etc...
I want to help get these out of the search engines so I want to redirect these links to www.abc.com. Now for the rule you referenced. I'm not sure where to begin but here is my attempt.
# Externally redirect direct client requests for dynamic URLs to new-style static URLs
# (in case your dynamic URLs accidentally get exposed to the search engines)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ \.php\?c=([^&]+)&d=([^&\ ]+)\ HTTP/
RewriteRule ^\.php$ [abc.com...] [R=301,L]
I'm really confused, lol. Do I have to add this info to the .htaccess as well?
#An example of {THE_REQUEST} would be:
GET /mytown/index.php?c=widgets&d=14 HTTP/1.1
Thanks for your help and patience!
B
# Externally redirect direct client requests for "/" with "p=" or "t=" querystrings to the home page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?[pt]=[^\ ]*\ HTTP/
RewriteRule ^$ http://www.example.com/? [R=301,L]
Jim
It appears to be functioning correctly with my existing rewrite...
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^newdomain.com [NC]
RewriteRule ^(.*)$ [newdomain.com...] [L,R=301]
# Externally redirect direct client requests for "/" with "p=" or "t=" querystrings to the home page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?[pt]=[^\ ]*\ HTTP/
RewriteRule ^$ [newdomain.com...] [R=301,L]
Due to the 301 redirect I setup when I changed domains, Google has indexed thousands of pages from my site that originally appeared as...
www.oldomain.com/phpbb/viewtopic.php?p=1399
now appear as...
www.newdomain.com/?p=1399
So I have thousands of indexed pages all going to the same place and the idexes that point to 'new' content are buried. Hopefully this will help clean up my indexed pages in the search engines.
Thank