【发布时间】:2017-08-04 13:10:54
【问题描述】:
我创建了一个在 root 上有多个目录的服务器:
- /网站
- /论坛
- /维基
- 等等……
当我访问该站点时,URL 是 mysite.org/site 或 mysite.org/forum。
我想要的是将我的 .htaccess 配置为像这样:
- 站点目录用作根目录:URL是mysite.org/blabla,但显示的是mysite.org/site/blabla的内容
- 其他目录用作子域: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
有人可以帮帮我吗?
【问题讨论】: