.htaccess复杂而棘手的重定向 [英] .htaccess complex and tricky redirection
问题描述
我不是.htaccess方面的专家,我需要一些复杂而棘手的帮助.
这是我当前的.htaccess
,请记住我需要一些可以破坏我当前的.htaccess
的.htaccess
.
当前.htaccess
:
RewriteRule ^join$ https://example.com/internalpath/join/index.php [L,QSA]
RewriteRule ^join/(.*)$ https://example.com/internalpath/join/$1 [L,QSA]
现在是我的问题:
除了这两个以外,我想将每个文件和目录重定向到HTTP:
请记住,我想让http上的每个链接(除了上面提供的链接之外),否则所有文件和目录,甚至/join/或/join中的文件和目录都将是HTTP,仅是HTTP上的两个链接,但是请不要销毁以前的书面.htaccess.
您需要以下3条规则:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(join/.+)$ https://%{HTTP_HOST}/internalpath/$1 [R=301,NC,L]
RewriteCond %{HTTPS} off
RewriteRule ^(join)/?$ https://%{HTTP_HOST}/internalpath/$1/index.php [R=301,NC,L]
RewriteCond %{HTTPS} on
RewriteRule !^join http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]
I am not expert in .htaccess that my need bit complex and tricky help..!
Here is my current .htaccess
and remember i need some .htaccess
that can destroy my current .htaccess
.
Current .htaccess
:
RewriteRule ^join$ https://example.com/internalpath/join/index.php [L,QSA]
RewriteRule ^join/(.*)$ https://example.com/internalpath/join/$1 [L,QSA]
Now my problem:
I want to redirect each and every file and directories to HTTP, except these two:
Remember, I want every link on http except this above provided link, other then all files and directories and even files and directories in /join/ or /join will be HTTP, just two links on HTTP, but please it will not destroy the previous written .htaccess.
You need these 3 rules:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(join/.+)$ https://%{HTTP_HOST}/internalpath/$1 [R=301,NC,L]
RewriteCond %{HTTPS} off
RewriteRule ^(join)/?$ https://%{HTTP_HOST}/internalpath/$1/index.php [R=301,NC,L]
RewriteCond %{HTTPS} on
RewriteRule !^join http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]
这篇关于.htaccess复杂而棘手的重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!