重写 .htaccess 中的获取参数 [英] rewrite get parameters in .htaccess

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

问题描述

这是我的网站:http://www.example.com我想在 .htaccess 中重写 url这是网址:http://www.example.com/sub_portfolio.php?act=sub_cat我想..

Here is my website : http://www.example.com and i want to rewrite url in .htaccess here is URL : http://www.example.com/sub_portfolio.php?act=sub_cat and i want to ..

/sub_portfolio/sub_cat

我尝试了许多重写条件,但它不起作用,还检查了我们网站堆栈溢出中的许多帖子.像url重写条件

i tried many rewrite condition it not worked and also check many post in our website stack overflow. like url rewrite conditions

给个建议...

推荐答案

您可以使用以下代码轻松重写您的网址.

You can easily rewrite your url using the following code.

RewriteEngine On
RewriteRule ^sub_portfolio/([A-Za-z0-9-]+)/?$ sub_cat.php?act=$1 [NC,L]

确保将此代码放在应位于同一文件夹中的 .htaccess 文件中

希望有帮助

这篇关于重写 .htaccess 中的获取参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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