很简单,只要坚持沿着东西在任何一个的.htaccess文件在您的网站(不是有效,因为Apache会读取并解析对每个请求的文件的文档根目录下面的线,还假定目录包括已经在httpd.conf中被允许为您的网站文档根目录),最好在你的Apache的httpd.conf文件内的虚拟主机定义,或包含相关的.conf :
RewriteEngine On
RewriteCond %{HTTP_HOST) ^peku33\.net$ [NC]
RewriteRule ^/?SomeOTHERText/ SomeSite.php [L]
RewriteCond %{HTTP_HOST) ^mysite [NC]
RewriteRule ^/?SomethingElse/ SomeOtherSite.php [L]
RewriteCond %{HTTP_HOST) ^mysubdomaint [NC]
RewriteRule ^/?Blablabla/Blabla/ SomeotherSiteEtc.php [L]
#Attempt to block direct requests to a .php script, only internally rewritten requests should get through
RewriteCond %{THE_REQUEST} SomeSite\.php [NC]
RewriteRule ^/?SomeSite.php - [F,NC]
注:
F = Fail (Could use G=Gone or R=### instead)
NC = Not Case-sensitive
L = Last
^/? = optional leading slash, best to leave in place, as the leading slash is stripped from the URI, when the rule is .htaccess based.
阿帕奇mod_rewrite文档值得一读,如果你不清楚什么上面的规则做,或者如果你想要的东西多一点抽象考虑以下post。
是的,这是真的,但我想要http://peku33.net/SomeOTHERText/显示/SomeSite.php的结果 – peku33