What should I put in .htaccess to redirect all links from main domain to subdomain? I have it like that but it doesnt wok:
RewriteCond %{HTTP_HOST} ^http://example.com/$
RewriteRule ^(.*)$ http://subdomain.example.com/$1 [R=301,L]
Have you tried without the http://
and the /
at the end in the first line ?
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^(.*)$ http://subdomain.example.com/$1 [R=301,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.