0
我JAVE的服務器有多個目錄根:的Apache,根,子域和子目錄
- /網站
- /論壇
- /維基
- 等等...
當我訪問該網站時,網址是mysite.org/site或mysite.org/forum。
我想什麼太配置我的.htaccess的行爲是這樣的:
- 網站目錄作爲根目錄:該URL是mysite.org/blabla,但它顯示的mysite的內容.ORG /網站/布拉布拉
- 其他目錄作爲子域:URL是forum.mysite.org但它顯示mysite.org/forum
我不能設法得到這個工作.. 。
目前我的.htaccess是這樣的:
RewriteEngine On
# Map http://www.example.com to /site.
RewriteRule ^$ /site/ [L]
# Map http://www.example.com/x to /site/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/site/
RewriteRule ^(.*)$ /site/$1
# Add trailing slash to directories without them so DirectoryIndex works.
# This does not expose the internal URL.
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !/$
RewriteRule ^(.*)$ $1/
# Disable auto-adding slashes to directories without them, since this happens
# after mod_rewrite and exposes the rewritten internal URL, e.g. turning
# http://www.example.com/about into http://www.example.com/site/about
DirectorySlash off
有人可以幫我嗎?
不幸的是,我不在專用服務器上,所以我無法更改conf文件。這就是爲什麼我想通過編輯htaccess來做到這一點。 –