homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

301 redirect help me

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

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]

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

Thank You..



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

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.


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


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.


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

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


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

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.)


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

@lucy24 did not friends


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

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved