如何改写域名网址到一个特定的域名,如果它没有与之相匹配的。
How can i rewrite the domain url to a specific domain name if it didnt match it ..
比方说,我希望它只匹配example.com 和访问者来自服务器的ip(http://127.0.0.1/something/else)或来自另一个域(http://domain.com/something/else)
Let's say i want it to only match example.com and the visitor came from server ip (http://127.0.0.1/something/else) OR came from another domain (http://domain.com/something/else)
我怎么能改写域名,并保留所有的其他参数,只是域名example.com(结果应该是:的 http://example.com/somthing/else )
how can i rewrite the domain name and keep all the other parameters, just domain name to example.com ( result should be : http://example.com/somthing/else )
尝试在你的文档根目录下添加这些规则的htaccess文件:
Try adding these rules to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www.)?example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R]
上一篇:在mod_rewrite的URL中的特殊字符特殊字符、mod_rewrite、URL
下一篇:Apache的.htaccess中的AddHandler Conditionnal的服务器名或IP服务器、htaccess、Apache、AddHandler