除了重定向一个网页到子域名htaccess的所有页面

编程入门 行业动态 更新时间:2024-10-27 02:26:42
本文介绍了除了重定向一个网页到子域名htaccess的所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个的index.php在我的主域根

I have a index.php in my main domain root

domain/index.php

domain/index.php

和香港专业教育学院搬到我的论坛这是在同一个根到一个子域

And ive moved my forums which was in the same "root" to a subdomain

forums.domain

forums.domain

我需要重定向以外的所有的index.php

I need to Redirect everything except the index.php

香港专业教育学院tryed的方式加载并没有似乎工作

ive tryed loads of ways and none seem to work

Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !index\.php$ RewriteRule ^(.*)$ forums.domain [L,R] RewriteEngine On RewriteCond %{HTTP_HOST} animelon\ [NC] RewriteCond %{REQUEST_URI} !^index\.php$ RewriteRule ^(.*)$ forums.domain/$1 [R=301,L]

如果任何人有任何想法,将是巨大的 作为上述codeS我想他们在Google上搜寻有关。 干杯

If anyone has any ideas that would be great as for the above codes I would them googling about. Cheers

推荐答案

您可以使用,而不是重写RedirectMatch,就是代替你都显示了所有重写块:

You may use RedirectMatch instead of rewriting, that is, replace all the rewrite block you are showing with:

RedirectMatch ^(/(?!index\.php).*) forums.domain$1

您可以看到正则表达式对Regexr 这里的完整解释。简言之,它发出的所有URI的不可以开头的index.php 来forums.domain。

You can see the full explanation of the regex on Regexr here. In brief, it sends all the URIs NOT beginning with /index.php to forums.domain.

如果你不需要任何其他的重写规则,你可以关闭通过删除所有来自你的.htaccess改写开头的行重写。

If you don't need any other rewrite rule, you can turn off rewriting by removing all the lines beginning with "Rewrite" from your .htaccess.

更多推荐

除了重定向一个网页到子域名htaccess的所有页面

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

发布评论

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

>www.elefans.com

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