[英]htaccess second rewrite rule not working
I made a website and placed this code in the .htaccess
file 我做了一个网站,并将此代码放在
.htaccess
文件中
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*)$ profile.php?id=$1 [QSA,L]
RewriteRule (.*)$ category.php?id=$1 [QSA,L]
Now, the first Rewrite rule works as expected, allowing me to have urls like site.com/profile
instead of site.com/profile.php?id=foo..
but, when I added the second one, to achive the same result as the above solution, the page breaks down, and the css does not get included. 现在,第一个重写规则按预期工作,使我可以使用
site.com/profile
之类的网址,而不是site.com/profile.php?id=foo..
但是,当我添加第二个规则时,可以获得相同的结果作为上述解决方案,页面崩溃了,并且没有包含CSS。 So, it seems that the two can not be writen together, and I don't know what the solution is. 因此,似乎无法将两者同时写入,而且我不知道解决方案是什么。
Try changing to: 尝试更改为:
RewriteRule ^profile/(.*)$ profile.php?id=$1 [QSA,L]
RewriteRule ^category/(.*)$ category.php?id=$1 [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.