Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 '14 at 4:51
    
Well what happens then? What does the resulting URL look like? – zigojacko Mar 10 '14 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.