• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Redirect to new domain in Wordpress

Yet again baffled by .htaccess

I have this site : http://www.marlboroughworldleather.com

Which I want to redirect, keeping the URLs after the domain intact to this :

http://www.marlboroughworld.com/

I've got this in .htaccess:

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

However it only redirects if the domain is typed in, for example, I can still go here :
http://www.marlboroughworldleather.com/product-category/homeoffice/ipad-and-iphone-cases/

When it should redirect to here :

http://www.marlboroughworld.com/product-category/homeoffice/ipad-and-iphone-cases/

Any ideas?
0
andythecal
Asked:
andythecal
1 Solution
 
Zephyr ICTCloud ArchitectCommented:
Wouldn't this be better? Can't test if it would be.

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

Open in new window

0
 
Robert SaylorSenior DeveloperCommented:
Are you using SSL? This will only redirect non SSL. Another option would be to use php.
0
 
andythecalAuthor Commented:
Tried spravtek's solution but I get the same, anything outside the root path isn't redirected.

Nope - not SSL.
0
 
ScorchDCommented:
This issue is explained well here, I have had to do this a few times.

http://stackoverflow.com/questions/5690673/wildcard-domain-redirect-with-wordpress
0
 
andythecalAuthor Commented:
Bang on! Worked a treat.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now