一个URL具有多个GET变量mod-rewrite规则 [英] mod rewrite rule for a url with multiple get variables

查看:166
本文介绍了一个URL具有多个GET变量mod-rewrite规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林新URL重写,即时通讯能够建立简单的规则,但无法建立一个URL由多个获得变量的规则

Im new to url rewriting, Im able to build simple rules but unable to build a rule for a url consisting of multiple get variables

我的网址是:http://www.mywebsite.com/index.php?AKey=fjdsakfd&uid=2&cl=Election&req=Voters

我想要一个干净的网址,如: http://www.mywebsite.com/voters

请帮我建立正确的重写规则为上面的'洁净的URL

Kindly help me in building the correct rewrite rule for the above 'clean url'

推荐答案

将这个code在 DOCUMENT_ROOT /的.htaccess 文件:

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^voters/?$ /index.php?AKey=fjdsakfd&uid=2&cl=Election&req=Voters [L,QSA,NC]

编辑:基于评论:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?cl=$1&req=$2 [L,QSA]

这篇关于一个URL具有多个GET变量mod-rewrite规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆