htaccess的重写子域

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

您好我有一个在主服务器的一个子目录位于一个独立的网站。

Hi I have a independent site that sits within a sub-directory of a main server.

子目录网站内点到根的所有链接,我想捕捉那些,并将它们发送回子目录,而不是根目录。

All links within the sub-directory site point to the root and I'd like to capture those and send them back to the sub-directory rather than the root.

这可能与htaccess的?

Is this possible with htaccess?

推荐答案

这不会重定向到子目录,但要其他域的行为就好像子目录是文档根。我认为这是更好的。

This will not redirect to the subdir, but make the other domain behave as if the subdir is the document-root. Which I think is even better.

RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^seconddomain.nl$ [NC] RewriteCond $1 !^subfolder RewriteRule ^(.*)$ /subfolder/$1 [L]

更多推荐

htaccess的重写子域

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

发布评论

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

>www.elefans.com

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