We can redirect URL's from any subdirectory (like maindomain.com/dorectoryname) to a sub domain (subdomain.maindomain.com) using PHP and .htaccess by the subsequent ways.
For example, the .htaccess file is full of rules like the following:
For example, the .htaccess file is full of rules like the following:
------------------------------------------------------------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$
RewriteRule ^dorectoryname/(.*)$
http://subdomain.maindomain.com/$1 [L,QSA,R=301]
or we can using this code
RewriteCond %{REQUEST_URI} ^/
dorectoryname
RewriteRule ^(.*)$ http://
subdomain.
maindomain.com/$1 [R=301,L,P]
No comments:
Post a Comment