我见过的网站已用其他内容替换了原来的网址。示例:他们使用http://url.com/profile/index.php?username=USERNAME
http://url.com/profile/USERNAME
我该怎么做?
答案 0 :(得分:0)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(profile)/([^/.]+)/?$ /$1/index.php?username=$2 [L,QSA,NC]