我正在使用WAMP,并在"http://localhost/snap2/html"文件夹中创建了一个网站。我正在尝试执行以下重写规则,但这对我不起作用。
服务器在下面给我一个错误:
在此服务器上找不到请求的 URL/snap2/html/browsed.html。
我的.htaccess文件位于html文件夹中,其结构如下:
'重写引擎开启
RewriteRule ^decision/([0-9]+)$/snap2/html/decision.php?面板 ID=$1'
网站的结构类似于'www/snap2/html
事实上,我正在尝试重写以下网址
http://localhost/snap2/html/decision.php?PanelID=20
在到
http://localhost/snap2/html/decision/20
此外,选项 +关注符号链接给了我一个错误 500,因此,我已经对其进行了评论。
任何帮助将不胜感激。
试试这个:
RewriteEngine On
RewriteRule RewriteRule ^snap2/html/decision/([0-9]+)$ /snap2/html/decision.php?PanelID=$1
但我想这不是你想要的。但也许你会看到你错在哪里。
正则表达式中的符号^
意味着以下字符串应位于 URL 的开头。 所以你必须包括整个路径,参见htaccess RewriteEngine 了解更多示例
你写了两次RewriteRule
。尝试
RewriteRule decision/([0-9]+)$ /snap2/html/decision.php?PanelID=$1 [L, QSA]
或
RewriteRule snap2/html/decision/([0-9]+)$ /snap2/html/decision.php?PanelID=$1 [L, QSA]