I am trying to redirect a domain to a subfolder within the same server. Let me break it down on topics:
I can't figure out how though. I suppose I need to create a rewriting rule but don't know how.
To Redirect sub.example.com
to example.com/folder
you can use the following Rule in your /public_html/. htaccess
/public_html/. htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub\.example\.com$ [NC]
RewriteRule (.*) http://example.com/folder/$1 [L,R=301,NE]
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.