[英]Rewrite URL with multiple unset query parameters .htaccess
I have read lots of questions regarding URL rewriting with multiple parameters. 我已经阅读了很多有关使用多个参数进行URL重写的问题。 However I still cannot fix this issue:
但是我仍然无法解决此问题:
I have this URL with multiple parameters, some of them without a value 我的网址带有多个参数,其中一些没有值
http://localhost:8888/coches/index.php?maker=all&model=®istration_year=&price_until=&tfseekfid=main_search&s=~
I would like to rewrite it to http://localhost:8888/coches/all-cars
我想将其重写为
http://localhost:8888/coches/all-cars
I have tried this rule and several other ones but can´t get it to work. 我已经尝试过此规则以及其他一些规则,但是无法使其正常工作。
RewriteRule ^all-cars$ /index.php?maker=all&model=®istration_year=&price_until=&tfseekfid=main_search&s=~ [L,QSA]
Can anyone help? 有人可以帮忙吗? Thanks
谢谢
Location of the .htaccess
file containing this rule is important. 包含此规则的
.htaccess
文件的位置很重要。 You can have .htaccess
files in sub-directories. 您可以在子目录中具有
.htaccess
文件。
If the .htaccess
file is in your docroot you need to specify the directory in your rule: 如果
.htaccess
文件位于您的文档根目录中,则需要在规则中指定目录:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^coches/all-cars$ /coches/index.php?maker=all&model=®istration_year=&price_until=&tfseekfid=main_search&s=~ [L,QSA]
</IfModule>
If the file is /coches/.htaccess
, remove the leading /
from your rule to make it relative to the sub-directory: 如果文件是
/coches/.htaccess
,请从规则中删除前导/
使其相对于子目录:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^all-cars$ index.php?maker=all&model=®istration_year=&price_until=&tfseekfid=main_search&s=~ [L,QSA]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.