htAccess 第二次重写规则不起作用


htaccess second rewrite rule not working

我做了一个网站,把这段代码放在.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]

现在,第一个重写规则按预期工作,允许我拥有像 site.com/profile 这样的 url 而不是site.com/profile.php?id=foo..但是,当我添加第二个时,为了获得与上述解决方案相同的结果,页面崩溃,并且 css 不包括在内。所以,看来两者不能一起写,也不知道有什么办法。

尝试更改为:

RewriteRule  ^profile/(.*)$ profile.php?id=$1 [QSA,L]
RewriteRule  ^category/(.*)$ category.php?id=$1 [QSA,L]