如何使用Htacess的www.example.com/type.php?user=name [英] How To Use Htacess for www.example.com/type.php?user=name

查看:182
本文介绍了如何使用Htacess的www.example.com/type.php?user=name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要重定向 www.example.com/type/name www.example.com/type.php?user=name

{
    RewriteRule ^([a-zA-Z0-9_-]+)/type$ type.php?key=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/type/$ type.php?key=$1
}

请帮我这件事。

推荐答案

试试这个,希望它可以帮助:

RewriteBase /www.example.com
RewriteEngine On


RewriteRule ^type/(.*)/$ /type.php?user=$1
#OR
RewriteRule ^(.*)/(.*)/$ /$1.php?user=$2

PS:第一种方法仅适用于网址: www.example.com/type/value 的,第二个适用于您的站点前的任何页面: www.example.com/anypage/value

PS : The first one works only for the url : www.example.com/type/value ,the second one works for any page in your site ex: www.example.com/anypage/value

这篇关于如何使用Htacess的www.example.com/type.php?user=name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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