当用户输入myhomepage.com/username
时,他/她应该被重定向到myhomepage.com/?username
。
分别为:myhomepage.com/index.html?username
如果用户输入带有问号的网址:myhomepage.com/?username
,则应忽略mod_rewrite
。
修改
这是我试过的:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html?$1
答案 0 :(得分:1)
在RewriteCond
RewriteEngine On
# Rule only applies when we have an empty querystring
RewriteCond %{REQUEST_QUERYSTRING} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html?$1