1
我有一個.htaccess文件,工作正常。 但是,不適用於/specialsubfolder
。 http://www.mydomain.com/specialsubfolder/index.php
重定向到401.shtml
。htaccess爲子文件夾重寫
所以,我修改.htacces這樣的:
RewriteEngine On
#part I of .htaccess, performed for everything
#stops part II from execution if specialsubfolder
RewriteCond %{REQUEST_URI} "/specialsubfolder/"
RewriteRule (.*) $1 [L]
#part II of .htaccess, performed for everything except specialsubfolder
工作正常。剩下的唯一問題是將特殊子文件夾的所有http重定向到https。
不幸的是,下面的代碼不起作用(無論如何重定向到401.shtml錯誤頁面)。爲什麼?
RewriteEngine On
#part I of .htaccess, performed for everything
#http to https for specialsubfolder
RewriteCond %{REQUEST_URI} "/specialsubfolder/"
RewriteCond %{HTTPS} !=on
RewriteRule ^(specialsubfolder/.*)$ https://www.mydomain.com/$1 [R=301,L]
#stops part II from execution if specialsubfolder
RewriteCond %{REQUEST_URI} "/specialsubfolder/"
RewriteRule (.*) $1 [L]
#part II of .htaccess, performed for everything except specialsubfolder
謝謝。
謝謝。根據你的回答,我發現了一個錯誤。非常感謝! – Haradzieniec 2012-02-02 12:48:42
不客氣。 – anubhava 2012-02-02 13:23:53