Need help with setting up the url rewrite

New to mod_rewrite? This is a good place to start.

Postby richardk » Thu Oct 15, 2009 2:30 pm

You should update your sitemap or search engines will visit the old URLs. Even if they get redirected to the right URL, it's a waste of resources.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

I updated

Postby revo » Tue Nov 24, 2009 3:52 pm

Hi,

I updated my sitemap for google and resubmitted last month.

I put in the permanent redirect code in my htaccess as in our previous post.

all this I did at the same time, but I lost nearly all of my indexed urls I am back down to about 30 indexed urls with google...

Should I remove that permanent 301 code in my htaccess? WIll this help gain more indexed urls again?
revo
 
Posts: 34
Joined: Fri Feb 13, 2009 2:02 pm

Re: Need help with setting up the url rewrite

Postby revo » Wed Feb 24, 2010 8:59 am

Hi the links are starting to index. I have a big question after doing this url redirect to make my urls pretty where would I place an entire domain change and is it correct?

I am going from old.com to new.com but don't want to lose too much search engine rank. Currently I have this in old.com (old domain):

Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?merchant=([^&]+)(&.*)?$ [NC]
RewriteRule ^merch\.php$ /merch/merchant/%2? [R=301,L]

RewriteRule ^merch/merchant/([^/]+)/?$ /merch.php?merchant=$1 [QSA,L]]


DO I add this below code right at the end of all the above to change my domain name permanently and move my rankings over too?


Code: Select all
RewriteCond %{HTTP_HOST} ^old\.com$ [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]


So does this look correct ?
Do I put this in new.com (the new domain)

Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?merchant=([^&]+)(&.*)?$ [NC]
RewriteRule ^merch\.php$ /merch/merchant/%2? [R=301,L]

RewriteRule ^merch/merchant/([^/]+)/?$ /merch.php?merchant=$1 [QSA,L]

RewriteCond %{HTTP_HOST} ^old\.com$ [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]


and this in old.com (the old domain)

Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteCond %{HTTP_HOST} ^old\.com$ [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]


or would this do the same thing?

Code: Select all
redirect 301 / http://www.new.com/


I am not exactly sure what this means and if I did it correctly, can you tell me, like the asteriks and $1 and old\.com$ , not sure what the \ does?

Code: Select all
RewriteCond %{HTTP_HOST} ^old\.com$ [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]
revo
 
Posts: 34
Joined: Fri Feb 13, 2009 2:02 pm

Previous

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 8 guests

cron