[英]URL rewrite rules not working
current URL 当前网址
http://mywebsite.com/explore.php?location=india&search_query=about&filter[]=v
Desired URL 所需的URL
http://mywebsite.com/explore/india/about/v
Rules used: 使用的规则:
RewriteRule ^explore/([^/]*)/([^/]*)/([^/]*)$ /explore.php?location=$1&search_query=$2&filter[]=$3 [L]
You forgot to specify that your words can be more than one character. 您忘记指定您的单词可以超过一个字符。 I think you need something more like :
我认为您需要更多类似的东西:
RewriteEngine on
RewriteRule ^explore/([^/]*)/([^/]*)/([^/]*)$ /explore.php?location=$1&search_query=$2&filter[]=$3 [L]
With 用
http://mywebsite.com/explore/india/about/v
if you output $_GET
in explore.php
, you would get : 如果在
explore.php
输出$_GET
,则会得到:
array(3) {
["location"]=> string(5) "india"
["search_query"]=> string(5) "about"
["filter"]=> array(1) {
[0]=> string(6) "v"
}
}
Your actual RewriteRule
worked for something like : 您的实际
RewriteRule
适用于:
http://mywebsite.com/explore/i/a/v
Hope it helps 希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.