Forum Moderators: phranque

Message Too Old, No Replies

Cant get rewritecond to take .html

rewritecond .html rewriterule rewrite

         

Dthomas

8:33 pm on Feb 16, 2011 (gmt 0)

10+ Year Member



Hello, I am new and I do not know much about this, so I need some help. I want redirect some reviews of products that we sell from one sub domain to the product page of the specific product which is located on a different domain. so far i have this, see below, and it works perfectly when there is nothing behind the .com on the rewritecond line, but i need the long link ending in .html to work. any suggestions.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST}%{SCRIPT_URI} ^http://reviews.betterinnovations.com/product-reviews/Air-Quality/Air-Purifiers/Airfree/Airfree/p/ARF__P3000-Airfree-P3000-Onix-Air-Purifier-Sterilizer.html
RewriteRule ^(.*)$ [betterhealthinnovations.com...] [R=301]


Thanks in advance

jdMorgan

1:51 am on Feb 18, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like you're trying to do things the hard way... Try:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^http://reviews.betterinnovations.com
RewriteRule ^product-reviews/Air-Quality/Air-Purifiers/Airfree/Airfree/p/ARF__P3000-Airfree-P3000-Onix-Air-Purifier-Sterilizer.html$ http://www.betterhealthinnovations.com/Airfree_P3000_Onix_Air_Purifier_Sterilizer_p/arf-p3000.htm [R=301]

I'd strongly recommend a review of your URL-naming policy, as this URL is far too long and "keyword-spammy" -- all those repeats of "Airfree" are likely to be more a liability than a benefit... And I sure wouldn't want to try to send a friend to this URL by reading it to him on the phone!

Be aware also that the underscores are a search liability. They are treated "only somewhat" as spaces, and "A_B" will rank much more highly for a search on exactly "A_B" than it will rank for searches for "A B" or for "A-B". On the other hand, a hyphen is treated almost like a space by search engines. Therefore, you are giving up some keyword-in-URL ranking power by using "Airfree_P3000_Onix_Air_Purifier_Sterilizer" in the URL instead of "Airfree-P3000-Onix-Air-Purifier-Sterilizer".

It used to be that a URL of "A_B" would *only* match a search for exactly "A_B" and not match at all for searches for "A B" or for "A-B". While that 'rule' has been relaxed a little, the underscore is still not treated as a space or a hyphen in search -- it's sort of only half-way treated as a space or a hyphen.

In this respect, your old review URLs are actually much better than your new product page URLs.

And one more thing: Note that underscores in links easily "hide" under link underlining. They're often impossible to tell from spaces...

Finally, consider standardizing across your review and sales (sub)domains, so that the only difference between a review and a product page URL-path is that the first starts with "product-review/" -- That would likely make your site a bit easier to administrate.

Note that I do not recommend changing your current URLs. This is a 'going forward' suggestion only. Changing current URLs may result in painful (even if temporary) ranking loss.

Jim