【发布时间】:2016-07-15 01:15:44
【问题描述】:
我有一个简单的重定向规则如下:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^contact-us\/?.*$ ./contact-us.php [NC,QSA,L]
此规则适用于以下 URL:
http://localhost/folder1/folder2/folder3/contact-us/
问题是,如果我删除最后的斜线,页面会正确加载,但资源(css/js)没有加载
http://localhost/folder1/folder2/folder3/contact-us ----> This fails
在尝试加载资源时似乎省略了一个文件夹,因此 JS 资源的 URL 设置为 http://localhost/folder1/folder2/js/jquery.js 而不是 http://localhost/folder1/folder2/folder3/js/jquery.js
这里是否缺少规则中的概念?如何使两个 URL 都起作用?
【问题讨论】: