[英]mod_rewrite Add another rule
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ index.php?p=$1 [L]
I use this to forward all routing to index.php, If I would to rewrite the following: 如果要重写以下内容,则可以使用它将所有路由转发到index.php:
http://localhost/folder/method/value http:// localhost / folder / method / value
And that would be 那将是
http://localhost/folder/method/?f=value http:// localhost / folder / method /?f = value
How do I make it work? 我该如何运作?
See the mod rewrite tage wiki and example 6. 请参阅mod rewrite tage Wiki和示例6。
For your specific case you could just prepend a rule like 针对您的特殊情况下,你可能只是在前面加上如下规则
RewriteRule ^(\w+)/(\w+)/(\w+)$ $1/$2/?f=$3 [L]
See also Serverfault: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? 另请参阅Serverfault:您想了解的有关Mod_Rewrite规则的所有内容,但不敢问? to learn about rule ordering.
了解规则排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.