所以我有一个article.php
而我正在尝试做的不是article.php?id=1
。我正在尝试article/1
。所以这就是我正在做的事情
RewriteRule ^/article/([0-9]+)\.php /article.php?id=$1
我得到的只是
The requested URL /article/.php was not found on this server.
我认为这与我重写的其余部分有关。这是我得到的所有代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^/article/([0-9]+)\.php /article.php?id=$1
有什么想法吗?
答案 0 :(得分:1)
你有没有试过像:
RewriteRule ^article/([0-9]+)$ article.php?id=$1
而不是你拥有的东西?
编辑:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^article/([0-9]+)$ article.php?id=$1
RewriteRule ^([^\.]+)$ $1.php [NC,L]