0

I want to redirect all the WordPress urls of the form

http://example.com.previewdns.com/my-favorite-post/ to

http://example.com/my-favorite-post/

I am trying to do this with the below .htaccess code.. But its not working

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example.com.previewdns.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Please help

1

Try this...

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}  ^example\.com\.previewdns\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
2
  • Hi !Thanks for the reply. I've tried your code. It's not working! – Pramod Mar 10 '14 at 4:51
  • Well what happens then? What does the resulting URL look like? – zigojacko Mar 10 '14 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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