Php htaccess转换为frendly URL

Php htaccess转换为frendly URL,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,原始URL:http://localhost/store/?til=product&id_product=25&title=blue-篮子 通缉网址:http://localhost/store/products/blue-basket 我想知道是否有某种方法可以隐藏id\u product=25的变量,如果没有,应该是这样的: http://localhost/store/products-25/blue-basket 我有这个。htaccess: Options +FollowSymLink

原始URL:
http://localhost/store/?til=product&id_product=25&title=blue-篮子

通缉网址:
http://localhost/store/products/blue-basket

我想知道是否有某种方法可以隐藏
id\u product=25
的变量,如果没有,应该是这样的:

http://localhost/store/products-25/blue-basket

我有这个。htaccess:

Options +FollowSymLinks
RewriteEngine On

RewriteBase /store/

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)?product&id_product=(.*)\ HTTP
RewriteRule ^ /store/products=%2? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^products=(.*)$ ?til=product&id_product=$1 [L,QSA]
结果:
http://localhost/store/products=25&title=blue-篮子

试试:

Options +FollowSymLinks -Multiviews
RewriteEngine On

RewriteBase /store/

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /store/(?:index\.php|)\?til=product&id_product=([0-9]+)&title=([^&\ ]+)
RewriteRule ^ /store/products-%1/%2? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^products-([0-9]+)/(.*)$ ?til=product&id_product=$1&title=$2 [L,QSA]

您可以将产品id添加到查询字符串中,例如firefox隐藏了查询字符串…它正在破坏所有CSS/IMAGES/JS
“NetworkError:404未找到-http://localhost....
@JS可能是因为您所有的CSS/images/JS都是相对URL链接,所以您需要将它们都设置为绝对URL或在页面标题中添加相对URI基(类似于