相关疑难解决方法(0)

URL重写:css,js和图像未加载

我遵循规则 .htaccess

Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteRule ^detail/([0-9]+)/?$ detail.php?id=$1
Run Code Online (Sandbox Code Playgroud)

它将http://localhost/detail/123URL 重定向到http://localhost/detail.php?id=123.页面重定向成功,但问题是CSS, JS, and images没有加载,

CSS,js文件位于http://localhost/css/http://localhost/js/

一种解决方案是使用绝对路径(ex/CSS或/ js而不仅仅是CSS /,/ js,但这似乎不是一个可靠的解决方案,因为我们要在所有文件上更改它,

.htaccess基于规则的任何其他解决方案,它独立于编辑所有PHP文件并让我们使用"相对路径"?

php apache .htaccess mod-rewrite url-rewriting

20
推荐指数
3
解决办法
5万
查看次数

标签 统计

.htaccess ×1

apache ×1

mod-rewrite ×1

php ×1

url-rewriting ×1