【发布时间】:2013-11-28 20:52:35
【问题描述】:
我的网站有一个可以调用的文件 (index.php),使用控制器我可以显示不同的页面。此页面位于 office/web 中。
我通过以下方式修改了我的 .htaccess:
Options +FollowSymlinks
RewriteEngine On # Turn on the rewriting engine
#skip existing files or directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#everything else goes to index.php
RewriteRule ^sale/chicago/?$ /office/web/index.php?action=w_filter&type=1&zone=3 [NC,L]
RewriteRule ^sale/?$ /office/web/index.php?action=w_filter&type=1 [NC,L]
RewriteRule ^rent/?$ /office/web/index.php?action=w_filter&type=2 [NC,L]
访问http://localhost/office/web/sale/chicago/时,页面加载,所以主要规则起作用。
但是,所需的所有其他文件(css、js...)都给出了 404 Not found 错误。
在html文件中使用<script type='text/javascript' src='assets/js/bootstrap.min.js'></script>,它期望
http://localhost/office/web/sale/chicago/assets/js/bootstrap.min.js
正确的网址是:
http://localhost/office/web/assets/js/bootstrap.min.js
等等,对于所有其他媒体文件。
我需要在 .htaccess 中添加/更改什么来解决这个问题?
【问题讨论】:
标签: php .htaccess mod-rewrite