How to remove a subdirectory from the url when forwarding to sudirectory?

前端 未结 1 1760
北海茫月
北海茫月 2021-01-25 00:17

On a shared server I am forced to manage document roots of domains from cpanel which is buggy and consumes lots of time. So I redirected all domains to one directory lets say

相关标签:
1条回答
  • 2021-01-25 00:53

    if I understand your question correctly, you should be able to do it by using the flag PT (Passthru), which causes the rewrite target to be passed back to the URL mapping engine:

    RewriteCond %{HTTP_HOST}   ^sd1.(domain1|domain2).com [NC]
    RewriteCond %{REQUEST_URI} !^/sd1/.*
    RewriteRule   ^(.*)  sd1/$1  [PT,L]
    

    Hope it helps.

    0 讨论(0)
提交回复
热议问题