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

share|improve this question

1 Answer 1

Try this...

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

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.