当前位置:Gxlcms > PHP教程 > .htaccessRewrite后css&js错误

.htaccessRewrite后css&js错误

时间:2021-07-01 10:21:17 帮助过:4人阅读

这是我的.htaccess文件

# BEGIN qiaoyixuan

RewriteEngine on
RewriteBase /qiaoyixuan/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

# END qiaoyixuan

我希望所有地址请求都被Rewrite到index.php,
当请求http://localhost/qiaoyixuan/2015时页面正常显示,
当请求http://localhost/qiaoyixuan/2015/(多一个‘/’)时,css和js出现错误

求解答,谢谢!

回复内容:

这是我的.htaccess文件

# BEGIN qiaoyixuan

RewriteEngine on
RewriteBase /qiaoyixuan/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

# END qiaoyixuan

我希望所有地址请求都被Rewrite到index.php,
当请求http://localhost/qiaoyixuan/2015时页面正常显示,
当请求http://localhost/qiaoyixuan/2015/(多一个‘/’)时,css和js出现错误

求解答,谢谢!

页面里面引用css和js的时候 没以 / 开头?

人气教程排行