Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've moved my WordPress installation from one domain to another, and I want to use an .htaccess file on the original to redirect visitors to the new page on the new website.

The old site is http://www.steve.doig.com.au/wordpress/.

The new site is http://www.superlogical.net

I tried using tried using the following .htaccess file in the /wordpress directory:

RedirectMatch 301 http://www.steve.doig.com.au/wordpress(.*) http://www.superlogical.net/$1

However, all this does is redirect visitors to the URL: http://www.superlogical.net/wordpress/

I guess this is working properly, but I don't have Wordpress installed in a /wordpress folder on the new domain. How do I remove this from the URL redirected to?

Thanks..

share|improve this question

3 Answers 3

As you’re using regexp on the second parameter you want to escape the dots. Change

http://www.steve.doig.com.au/wordpress(.*)

to

http://www\.steve\.doig\.com\.au/wordpress(.*)

The logic itself, how you meant it, should work though. Passing the following URL-part to the new URL.

share|improve this answer
    
Thanks. It successfully redirects from the /wordpress folder of the old website, but I receive a page not found error when I try to load the URL of an individual wordpress post on the old site. The browser still has the old URL in the address bar, indicating it has not tried to redirect the page. Do I need to include an .htaccess file in every content folder? –  Steve Mar 2 '11 at 4:26
    
.htaccess files will apply to the directory it is in as well as all sub-directories. See httpd.apache.org/docs/2.2/howto/htaccess.html#what –  Kissaki Mar 5 '11 at 3:33
    
Thanks, I thought so, but this doesn't change the fact it doesn't work for me. –  Steve Mar 7 '11 at 2:54

I've been told by my webhost to try the following:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?steve\.doig\.com\.au/wordpress/$ [NC]
RewriteRule ^(.*)$ http://www.superlogical.net/$1 [R=301,L]

But this only works for the /wordpress folder, and not for any post or category page.

share|improve this answer
up vote 1 down vote accepted

I since changed it to:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)$ http://www.superlogical.net/$1 [R=301,L]

Which resolved it for me.

share|improve this answer
    
I have some concern that by this able to redirect 301 to old domain to new domain but what about to redirect pages ...? –  user14966 Apr 26 '12 at 10:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.