的.htaccess需要重定向/重写帮助 [英] .htaccess redirect/rewrite help needed

查看:155
本文介绍了的.htaccess需要重定向/重写帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写htacess重定向规则,但它不能正常工作我已经尝试了许多解决方案,而只是它不能正常工作。

I am writing htacess redirect rule but it is not working properly I have tried many solutions but simply it is not working.

我想要做的是 我有网址 http://example.com/cms/index.php?page=filename 我要执行这个URL,并显示相应的页面,但在浏览器中它应该显示example.com/cms。而最重要的是我只是想纠正这一规则仅此页,它不应该影响到其他页面。

What I want to do is to I have url http://example.com/cms/index.php?page=filename I want this url to be executed and show appropriate page but in browser it should show example.com/cms. And what is important is I only want to right this rule for this page only and it should not effect to other pages.

感谢你。

推荐答案

重写规则^([^ /] +)/ $ /cms/index.php?filename=$1 [L,QSA]

RewriteRule ^([^/]+)/$ /cms/index.php?filename=$1 [L,QSA]

第l在最后说,这是最后一个规则(停止处理),并QSA手段查询字符串附加,所以,如果有人把它之后的其它参数,如:

The L at the end says it is the last rule (stop processing) and QSA means 'Query String Append', so if someone puts other parameters after it, such as:

http://example.com/cms.htm?order=desc

订单获取价值也将通过 - 没有它,它会只是静静地砸

The GET value for order will be passed also - without it it'll just quietly drop it.

这篇关于的.htaccess需要重定向/重写帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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