0
我正在努力重定向僅位於名爲店鋪的文件夾中的我的電子商店。 我有2個htaccess文件,一個在域根(專門用於公司網站),另一個放在商店文件夾中。 我試着重寫規則的許多變化,但我不能讓它工作...如何將特定文件夾從HTTP重定向到HTTPS
如果我把這個進店的htaccess文件我得到重定向循環錯誤:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
這並不在這兩個htaccess中做任何事情:
RewriteEngine on
RewriteCondition %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.maindomain.com/order/$1 [R=301,L]
這都不當我把它插入位於文檔根htaccess文件:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(subdirectory/.*)$ https://www.mydomain.com/$1 [R=301,L]
注意:如果它有什麼區別,我也有這個重定向規則。它坐落在文檔根htaccess的:
RewriteBase/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{HTTP_HOST} !^rumako.cz$ [NC]
RewriteRule ^(.*)$ http://rumako.cz/$1 [L,R=301]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
而這一次在該店的htaccess的:
RewriteEngine On
RewriteBase /shop
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
請指教。感謝所有的答案...
不幸的是,我遇到的,,此網頁有重定向循環」錯誤代碼。任何想法可能導致這種情況? – hjuster 2013-03-18 11:19:10
@hjuster這個規則單獨做我的測試環境中描述的重定向。你的根或商店htacces中是否有其他規則?你的商店htaccess中有'R'標誌嗎? – 2013-03-18 11:21:52
我已經更新了這個問題,你可以在兩個htaccess文件中看到所有的重定向。順便說一句,感謝您幫助我...... – hjuster 2013-03-18 11:27:31