.htaccess complex and tricky redirection

2019-09-17 08:31发布

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:

https://example.com/join/

https://example.com/join

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.

2条回答
老娘就宠你
2楼-- · 2019-09-17 09:10

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]
查看更多
祖国的老花朵
3楼-- · 2019-09-17 09:24

Try this (not tested):

RewriteCond %{REQUEST_URI} !/join/?$ [NC]
RewriteRule ^(.*)$ http://domain.com/internalpath/$1 [R=301,QSA,L]
查看更多
登录 后发表回答