Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect all pages from old domain to new domain root page

301 redirect

10:49 pm on Jul 11, 2013 (gmt 0)

New User

joined:July 11, 2013
votes: 0

Hi there.
I want to redirect olddomain.com(without www) to newdomain.com(without www)including all the inner pages of old domain to newdomain.com (without www)

It should looks something like this:


should be 301 redirect to the new newdomain like below:


This is what I have in .htaccess file for redirecting at this moment:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://newdomain.com/$1 [R=301,L]
RewriteRule . /index.php [L]

# END WordPress

RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteRule ^/?$ "http\:\/\/\newdomain\.com" [R=301,L]

However, this code it's working for redirecting olddomain.com to newdomain.com

And the inner pages are looking like this:

olddomain.com/home/category/page.html is redirecting to ====> newdomain.com/home/category/page.html and not to newdomain.com like I want.

Can you help me with a code in .htaccess file?

Thank you,appreciated.
11:22 pm on July 11, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
votes: 551

Raise your hand if you saw the topic title and immediately screamed Noooooo!

This is what I have in .htaccess file

Where? Under the new domain or the old one? Or are they parallel domains in a shared userspace?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?$ "http\:\/\/\newdomain\.com" [R=301,L]

... Now wait a minute. I swear I saw this IDENTICAL rule configuration-- IfModule, RewriteEngine On, RewriteRule with conditions, close IfModule, and finally a domain redirect with superfluous escaping-- in another thread no more than two or three days ago. So you can simply dig it up and swipe their answer :)
11:59 pm on July 11, 2013 (gmt 0)

New User

joined:July 11, 2013
votes: 0

Sorry, I forget to mention that the .htaccess settings that I presented in my first post are placed on the old domain.
2:18 am on July 12, 2013 (gmt 0)

New User

joined:July 11, 2013
votes: 0

Also, I searched that for that thread about 1 hour and I didn't find anything related to my problem.
3:30 am on July 12, 2013 (gmt 0)


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

joined:Aug 10, 2004
votes: 106

welcome to WebmasterWorld, alaltaieri!

this is the thread lucy24 is referring to with similar issues in your .htaccess file.
creating ip exception for redirect in .htaccess - Apache Web Server forum:
http://www.webmasterworld.com/apache/4591901.htm [webmasterworld.com]

it's almost incredible to see the same set of unusual errors on two consecutive days.

regarding your current .htaccess file:
- before you fix anything you should reconsider your decision to redirect all urls on olddomain.com to the home page of newdomain.com - it's not a good experience for the visitor and google will at best treat this like a soft 404 and at worst penalize you for manipulation of pagerank.
- if you are redirecting all requested urls to another domain you shouldn't have any requirements for an internal rewrite.