.htaccess复杂而棘手的重定向

编程入门 行业动态 更新时间:2024-10-22 22:53:18
本文介绍了.htaccess复杂而棘手的重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不是.htaccess方面的专家,我需要一些复杂而棘手的帮助.

这是我当前的.htaccess,请记住我需要一些可以破坏我当前的.htaccess的.htaccess.

当前.htaccess:

RewriteRule ^join$ example/internalpath/join/index.php [L,QSA] RewriteRule ^join/(.*)$ example/internalpath/join/$1 [L,QSA]

现在是我的问题:

除了这两个以外,我想将每个文件和目录重定向到HTTP:

example/join/

example/join

请记住,我想让http上的每个链接(除了上面提供的链接之外),否则所有文件和目录,甚至/join/或/join中的文件和目录都将是HTTP,仅是HTTP上的两个链接,但是请不要销毁以前的书面.htaccess.

解决方案

您需要以下3条规则:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(join/.+)$ %{HTTP_HOST}/internalpath/$1 [R=301,NC,L] RewriteCond %{HTTPS} off RewriteRule ^(join)/?$ %{HTTP_HOST}/internalpath/$1/index.php [R=301,NC,L] RewriteCond %{HTTPS} on RewriteRule !^join %{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$ example/internalpath/join/index.php [L,QSA] RewriteRule ^join/(.*)$ example/internalpath/join/$1 [L,QSA]

Now my problem:

I want to redirect each and every file and directories to HTTP, except these two:

example/join/

example/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.

解决方案

You need these 3 rules:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(join/.+)$ %{HTTP_HOST}/internalpath/$1 [R=301,NC,L] RewriteCond %{HTTPS} off RewriteRule ^(join)/?$ %{HTTP_HOST}/internalpath/$1/index.php [R=301,NC,L] RewriteCond %{HTTPS} on RewriteRule !^join %{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

更多推荐

.htaccess复杂而棘手的重定向

本文发布于:2023-10-31 13:00:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:棘手   重定向   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!