清洁的.htaccess URL超过3 paramenters [英] .htaccess clean url with more than 3 paramenters
本文介绍了清洁的.htaccess URL超过3 paramenters的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的.htaccess,我似乎有一些问题得到它清理网址给我。
I am new to .htaccess and I seem to be having some problems getting it to clean up the url for me.
我
site.com?p=article&id=3&read=article title
我能够得到的第一个工作确定像 site.com/articles
变量。但是当我尝试走得更远服务器说它不能找到它。我尝试了好几种方法,其中没有一个似乎工作。
I am able to get the first variable to work ok like site.com/articles
. but when I try to go further the server is saying it cant find it. I have tried several methods none of which seem to be working.
RewriteRule ^([a-zA-Z0-9]+)$ index.php?p=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?p=$1
这上面是工作
我已经试过
RewriteRule ^([a-zA-Z0-9-z\-]+)(/([a-zA-Z0-9-z\-]+))?/?$ index.php?p=$1&i=$2
和
RewriteRule ^([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]+)/?$ index.php?p=$1&i=$2&read=$3
在过去2不工作。请帮助。谢谢
the last 2 are not working. help please. Thanks
推荐答案
%{QUERY_STRING}是你所期待的。
%{QUERY_STRING} is what you are looking for.
这是我使用了类似的情况:
this is what I use for a similar situation:
RewriteRule ^/(.*) /index.php?r=/$1&%{QUERY_STRING} [L]
这篇关于清洁的.htaccess URL超过3 paramenters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文