【发布时间】:2011-06-09 05:21:24
【问题描述】:
我希望能够在 URL 中输入以下内容:
https://mydomain.com/fork 或者 https://mydomain.com/fork/
两个都转到一个名为
的子文件夹https://mydomain.com/prod/fork_contents/index.html
但仍然只显示https://mydomain.com/fork(或https://mydomain.com/fork/,无论哪种方式)
我希望 index.html 充当根目录,以便所有图像 url 等仍然有效(它们相对于 '/prod/fork_contents/')
目前根目录下的.htaccess是:
ErrorDocument 404 /live/site_documents/document404.html
ErrorDocument 403 /live/site_documents/accessDenied.html
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^fork$ /fork/index.html [L,QSA]
RewriteRule ^fork/$ /fork/index.html [L,QSA]
RewriteRule ^fork/(.*)$ /prod/forklift_contents/$1 [L,QSA]
- https://mydomain.com/fork/ 工作正常!
- https://mydomain.com/fork 不起作用。 index.html 加载,但找不到任何文件。 Firebug 的网络面板报告以下“未找到 https://mydomain.com/css/style.css”。所以第二种情况(没有尾随的 /)似乎不知道进入https://mydomain.com/fork/css/style.css。
想法?
【问题讨论】:
标签: apache .htaccess mod-rewrite