Welcome to WebmasterWorld Guest from 54.226.62.26

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 redirect help me

     

golgesiz

9:07 am on Aug 16, 2013 (gmt 0)



Hello...
I have a problem...
I did my field 301 redirect the old domain to new domain in my area, but did not replace the google rankings yet..
I wonder if I'm doing is wrong..
My domain infrastructure was created with wordpress..
The code you use in this way now..

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^http://olddomain.com/$ [NC]
RewriteRule ^(.*)$ http://newdomain.pro/$1 [L,R=301]
</IfModule>



Are you the author of the current code, please ..

Thank You..

g1smd

1:38 pm on Aug 16, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Your code says if the request is NOT for the old hostname, redirect to the new one.

It also has incorrect pattern (http:// is not required) and missing escaping.

Try:

RewriteCond %{HTTP_HOST} !^(example\.com)?$
RewriteRule (.*) http://example.com/$1 [R=301,L]


or

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


This redirects all requests that are not for exactly the right hostname over to the new one.

golgesiz

8:21 pm on Aug 16, 2013 (gmt 0)



@g1smd thank you.
 www.olddomain.com redirect newdomain.com
oldomain.com redirect newdomain.com

lucy24

9:28 pm on Aug 16, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



but did not replace the google rankings yet

Google moves on its own time. All you can do is ensure that the redirect is happening.

Do the two domains live on the same server? Are there other domains that you don't want to redirect? One possible form is

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{HTTP_HOST} (example\.com|example\.org)
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

where .org is the old name and .com is the new name. (If your two domains really were example dot com and example dot org, the second condition could of course be collaped into "example\.(com|org)". But in real life I assume you've got two entirely different names.)

golgesiz

8:04 pm on Aug 19, 2013 (gmt 0)



@lucy24 did not friends

lucy24

8:33 pm on Aug 19, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



I hope that translates as "I am not a native speaker of English and therefore have no idea what you're saying" :(
 

Featured Threads

Hot Threads This Week

Hot Threads This Month