具有URL参数的Apache RewriteRule [英] Apache RewriteRule with url parameters

查看:69
本文介绍了具有URL参数的Apache RewriteRule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.我可以将RewriteRule与url参数一起使用吗?
Ex: www.foo.com/user/admin/?html=edit
其中:html = edit用于显示表单以编辑用户配置文件.


2.我能找到有关RewriteRule apache模块的好文档吗?

1.Can I use RewriteRule with url parameters ?
Ex: www.foo.com/user/admin/?html=edit
where: html=edit used to display form to edit user profile.


2.Can I find a good docs about RewriteRule apache module.

推荐答案

是的,

在.htaccess中简单添加以下内容

Simple add the following in your .htaccess

 RewriteEngine On 

 RewriteRule ^user/(.*)/(.*) index.php?module=user&section=$2 [L]

现在在您的索引中,您将找到发送的获取参数,也可以通过$ _SERVER ['REQUEST_URI']访问获取参数

now in your index you'll find the get params sent as get params you can also access it via $_SERVER['REQUEST_URI']

这篇关于具有URL参数的Apache RewriteRule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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