我遵循规则 .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文件并让我们使用"相对路径"?