How can I redirect from one subdomain to another in .htaccess?
Enable mod_rewrite
and .htaccess
through httpd.conf
and then put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine OnRewriteCond %{HTTP_HOST} ^jquery\.webcodehelpers\.com$ [NC]RewriteRule ^ http://uieiq.webcodehelpers.com%{REQUEST_URI} [L,R=301,NE]
Please read: Apache mod_rewrite Introduction
This worked for me, and maintains the URI:
RewriteCond %{HTTP_HOST} ^jquery\.webcodehelpers\.comRewriteRule (.*)$ http://uieiq.webcodehelpers.com/$1 [R=301,L]
I used this to redirect a subdomain to another subdomain.