Php 使用mod rewrite重定向网页

Php 使用mod rewrite重定向网页,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我正试图得到: www.exampleurl.com/shop/detail.html?id=87&name=oil-iso-46-sae-20 决心 www.exampleurl.com/shop/87/oil-iso-46-sae-20 这不管用吗 RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.html$ /shop/detail.html?id=$1&name=$2 [L] 我尝试过添加-multiview、+follo

我正试图得到:

www.exampleurl.com/shop/detail.html?id=87&name=oil-iso-46-sae-20
决心

www.exampleurl.com/shop/87/oil-iso-46-sae-20
这不管用吗

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /shop/detail.html?id=$1&name=$2 [L]

我尝试过添加-multiview、+followsymlinks等。

而您想要的新URL没有
.html
后缀,但是您的重写规则依赖于.id=87和键入时遗漏的.html,这是我的错。即使URL中有这些后缀,它也不起作用。我得到一个404。你在浏览器中输入什么URL来测试这个?www.exampleurl.com/shop/87/oil-iso-46-sae-20.htmlAnd你想要的新URL没有
.html
后缀,但是你的重写规则取决于.id=87和我在键入时漏掉的.html,这是我的错。即使URL中有这些后缀,它也不起作用。我得到一个404。你在浏览器中输入什么URL来测试这个?www.exampleurl.com/shop/87/oil-iso-46-sae-20.html