2009-06-28 79 views
0

在下面的.htaccess例如,如果在类似如下的URL有人类型...处理子域和https与的.htaccess

http://mysite.com/ricks-motorcycles

...它会自动从X加载页面。 com的名为“ricks-motorcycles”的public_html下的子目录。这种技术被称为代理吞吐量

RewriteEngine On 
RewriteRule ^ricks-motorcycles/(.*)$ http://x.com/ricks-motorcycles/$1 [P,L] 

这是伟大的,但我怎么处理其他两种情况:

(1)有人想HTTPS,而不是http。

(2)有人想...

HTTP //#ricks-motorcycles.mysite.com/

...而不是...

HTTP //#mysite的。 COM /里克斯 - 摩托车/

(开关#有:由于以上StackOverflow的是可以发布拦截我)

回答

1

您可以用RewriteCond资格的重写:

RewriteEngine On 

RewriteCond %{HTTPS} =on 
RewriteRule ^ricks-motorcycles/(.*)$ https://example.com/ricks-motorcycles/$1 [P,L] 

RewriteCond %{HTTP_HOST} =ricks-motorcycles.mysite.com 
RewriteRule ^(.*)$ http://example.com/ricks-motorcycles/$1 [P,L] 

欲了解更多信息,请参阅mod_rewrite documentation

+0

谢谢,它足够接近我去。 – Volomike 2009-06-28 13:05:41