我只需要隐藏get request my url中的一个变量:
http://example.com/profile/?id=5&username=demo
我想:
http://example.com/player/demo
htaccess的:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^player/([^/]*)$ /profile/?id=$1&username=$2 [QSA,B]
答案 0 :(得分:0)
我的解决方案是改变
http://example.com/profile/?id=5&username=demo
到
http://example.com/player/5/demo
因为如果你使用你的建议
http://example.com/player/demo
有username
表示demo
但id
没有任何迹象,除非您按照以下方式执行此操作:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^player/(.*)/(.*)$ /profile/?id=$1&username=$2 [QSA,L]