0
我有一些域都重定向到相同的文件夾(我的public_html)。我想寫一個.htaccess文件,將每個域發送到它自己的文件夾(因此不在導航欄上顯示)。 例如,導航到http://example.com會加載我的服務器的文件夾/public_html/example.com/
。mod_rewrite重定向主機到另一個文件夾
在另一種情況下,我用這個代碼:
RewriteCond %{HTTP_HOST} example\.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.anotherdomain.com/$1 [R=301,L]
但現在我不想重定向到另一個域名;我只是想從另一個文件夾中獲取文件...
它可以實現嗎?提前致謝。
但我明確地說,我希望重定向 「example.com」?假設example.com將從'/ public_html/example.com /'中獲取文件,但是otherexample.com會導致到'/ public_html/abc/otherexample.com/public_html' ... – tyron
是的,您可以製作顯式的host- >目錄映射,請參閱我的編輯 –
表現正是我期待的。謝謝。 – tyron