我的htaccess中有这个,它可以完美地运行
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^explore/([^/]+)/([^/]+)/([^/]+) renderpage.php?menu=$1&submenu=$2&subsubmenu=$3 [L]
但我需要添加另一个,所以我添加了这个RewriteRule ^profiles/([0-9]+) profiles.php?id=$1 [L]
现在我的htaccess看起来像这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^explore/([^/]+)/([^/]+)/([^/]+) renderpage.php?menu=$1&submenu=$2&subsubmenu=$3 [L]
RewriteRule ^profiles/([0-9]+) profiles.php?id=$1 [L]
但当我转到ex:profiles/24
时,我得到404错误,但使用profiles.php?id=24正常工作,我做错了什么?
我认为规则没有任何问题。这应该很好。但我确实注意到您正在使用profiles
并重写为profiles.php
。因此,综合新闻可能会引起一些有趣的事情。试着把它关掉。
Options -MultiViews
RewriteEngine On
...