(没有测试过,所以如果这不能像你想的那样精确地工作,请阅读
我怎么能有。htaccess使例子从标题?访问者将在浏览器中输入http://mydomain.tld/somedomain.tld,我的whois脚本应该处理http://mydomain.tld/index.php?name=somedomain.tld并返回whois结果。
谢谢
使用Apache的mod_rewrite
.
RewriteEngine on
RewriteRule ^(.*)$ http://mydomain.tld/index.php?name=$1 [NC]
mod_rewrite
)
在你的。htaccess文件中试试下面的规则:
RewriteEngine on
Options +FollowSymlinks -MultiViews
RewriteCond %{QUERY_STRING} !^name= [NC]
RewriteRule ^([^/]*)/?$ /index1.php?name=$1 [L,R=301,NE,QSA]
上面的rewritecsecond将防止无限重定向。
NC
No Case comparison
R=301
将重定向为https状态301L
将创建最后一条规则NE
用于不转义查询字符串QSA
将附加您现有的查询参数
$1
是您的REQUEST_URI