[英]User friendly URL's for profiles
I have the following link: 我有以下链接:
www.website.com/profile.php?user=Test
I want to change the link to be: 我想将链接更改为:
www.website.com/Test
Where the username is after the /
without any extra gibberish. 用户名位于
/
后面,且无任何多余的乱码。
I have this set up in my .htaccess file, but it's not working. 我在.htaccess文件中进行了设置,但无法正常工作。 Why?
为什么?
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /website
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ profile.php?user=$1 [R,L,QSA]
Thanks. 谢谢。
Try this 尝试这个
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /website
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ profile.php?user=$1 [L,QSA]
Now you can access page from this URL. 现在,您可以从该URL访问页面。
www.website.com/Test
Try to add the following: 尝试添加以下内容:
Options +FollowSymLinks
RewriteEngine On
RewriteRule Test$ /profile.php?user=Test [QSA,L]
RewriteRule ^/(.*)$ /profile.php?user=$1 [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.