Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 使用htaccess缩短长url字符串_.htaccess_Smarty - Fatal编程技术网

.htaccess 使用htaccess缩短长url字符串

.htaccess 使用htaccess缩短长url字符串,.htaccess,smarty,.htaccess,Smarty,我对.htaccess非常陌生,但我确实需要缩短一些URL,例如 mydomain.com/pet-friendly-cottages.php?opt40=Yes&opt9=Yes&opt7=9 有没有办法用.htaccess隐藏问号后面的结束部分 此位=>opt40=Yes&opt9=Yes&opt7=9 非常感谢Jase。您应该使用Rewrite如: RewriteEngine on RewriteRule ^pets/([^/]*)/([^/]*)/([^/]*)$ /pet-friend

我对.htaccess非常陌生,但我确实需要缩短一些URL,例如

mydomain.com/pet-friendly-cottages.php?opt40=Yes&opt9=Yes&opt7=9

有没有办法用.htaccess隐藏问号后面的结束部分

此位=>opt40=Yes&opt9=Yes&opt7=9


非常感谢Jase。

您应该使用
Rewrite
如:

RewriteEngine on
RewriteRule ^pets/([^/]*)/([^/]*)/([^/]*)$ /pet-friendly-cottages.php.php?opt40=$1&opt9=$2&opt7=$3 [L]
然后,您的URL将如下所示:
site.com/pets/opt40/opt9/opt7