如何为个人资料页面制作虚荣URL

时间:2013-03-08 23:52:08

标签: php apache mod-rewrite

我想制作www.profstream.com/profile-t.php?username=arunsood - >例如www.profstream.com/arunsood。我的链接都在我的网站上设置,以访问原始网址,但我只是希望它显示为地址栏中的重写示例,并在有人在www.profstream.com/arunsood中输入时调用。

这是向我建议的mod重写规则,但它只是说我尝试时没有找到任何内容:

RewriteEngine On
RewriteRule ^([^/]*)$ /profile-t.php?username=$1 [L]

有没有办法让它在不改变网站上已有的链接结构的情况下工作?

1 个答案:

答案 0 :(得分:3)

试试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ profile-t.php?username=$1 [L,QSA]