Mobile app version of vmapp.org
Login or Join
Candy875

: Redirecting a Preview DNS subdomain to a domain with htaccess 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/

@Candy875

Posted in: #301Redirect #Htaccess #Redirects #Wordpress

I want to redirect all the WordPress urls of the form
example.com.previewdns.com/my-favorite-post/ to
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 ^(.*)$ example.com/ [L,R=301]


Please help

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Candy875

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jessie594

Try this...

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme