这是HostGator共享的托pipe帐户。
我有两个.htaccess文件。
一个在文档根目录中:`〜/ public_html / .htaccess'
# this is ~/public_html/.htaccess ## Redirect to https:// ## RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*) https://%{HTTP_HOST}/~myusername/$1 [R=301,L]
另一个是在一个子目录中: ~/public_html/software/drupal-7.0/.htaccess 。 这个.htaccess文件的内容可以在Drupal的git中find。
web根目录中.htaccess的function是将所有请求redirect到https:// 。 当我访问除了从~/public_html/software/drupal-7.0/ URL之外的任何URL时,这是有效的。
我希望我的https://redirect工作在~/public_html/software/drupal-7.0/ ,而不需要修改这个目录下的.htaccess文件。
移动~/public_html/software/drupal-7.0/.htaccess其他地方似乎允许https://redirect发生。
为什么我的redirect不在~/public_html/software/drupal-7.0/中提供的URL中?
subdir中的“RewriteOptions Inherit”会导致评估子目录中的规则,然后是父上下文中的规则。
如果drupal规则做了任何更改,由于这是每个目录的上下文,所以它们将在第二次通过该过程被发回,并且第二次通过规范主机名重写将生效。