.htaccess - 漂亮的用户配置文件 URL [英] .htaccess - Pretty User Profile URLs
本文介绍了.htaccess - 漂亮的用户配置文件 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让我的用户个人资料漂亮".这是常规网址:
I want to make my user profiles 'pretty' as it were. Here is the regular URL:
user.php?user=用户名
user.php?user=UserName
我希望它变成:
用户/用户名
请帮忙:) 我是 .htaccess 新手.
Please help :) Im a .htaccess newbie.
推荐答案
试试这些指令:
RewriteEngine on
RewriteRule ^user/([^/]+)$ user.php?user=$1 [L,QSA]
此规则将任何具有 /user/
foobar
形式的 URL 路径的请求在内部重写为 /user.php?user=
foobar
.
This rule rewrites any request with a URL path of the form /user/
foobar
internally to /user.php?user=
foobar
.
这篇关于.htaccess - 漂亮的用户配置文件 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文