的.htaccess重写子域

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

下面是我目前的code:

Here is my current code:

RewriteCond %{HTTP_HOST} !^example\ [NC] #RewriteCond %{REQUEST_URI}!^something RewriteCond %{HTTP_HOST} ^([^.]+)\.example\ RewriteRule (.*) something/%1/$1 [QSA,L]

我的目标是改写的http://*.example/whatever 到 example/something/* /不管,假设 * 是相同的两个和任何是相同的两个。不过,我相信这是造成一个无限循环不知何故,所以我补充说,注释掉线(的RewriteBase是/ BTW),但如果我取消,那么整个网站是一个500响应code。如果没有这一行,只有子域错误。

My goal is to rewrite *.example/whatever to example/something/*/whatever, assuming * is the same for both and whatever is the same for both. However, I believe this is causing an infinite loop somehow, so I added that commented out line (RewriteBase is / btw), but if I uncomment then the entire site is a 500 response code. Without that line, only the subdomains error.

我在做什么错了,我怎么能解决这个问题?我已经配置了服务器,所以,只要被重定向到我的public_html文件夹中。

What am I doing wrong, and how can I fix this? I have already configured the server so anything gets redirected to my public_html folder.

编辑:为了澄清,我试图做一个内部重定向,而不​​是外部

For clarification, I am trying to do an internal redirect, not external.

编辑:没有一个标志内部重定向看来。有没有我可以看到破碎的重写规则的实际错误消息的任何地方吗?如果我知道什么是错了,我将能够有更好的机会修复它。

There is not a flag for internal redirect it seems. Is there any place I can see the actual error message for the broken rewriterule? If I knew what was wrong I would be able to stand a better chance of fixing it.

推荐答案

我不明白规则重写域;也许这是你的问题。用你的code,试试:

I don't see the rule rewriting the domain ; maybe this is your problem. Using your code, try:

RewriteCond %{HTTP_HOST} !^example\ [NC] #RewriteCond %{REQUEST_URI}!^something RewriteCond %{HTTP_HOST} ^([^.]+)\.example\ RewriteRule (.*) example/something/%1/$1 [QSA,L]

我希望这将帮助你 杰罗姆·瓦格纳

I hope this will help you Jerome WAGNER

更多推荐

的.htaccess重写子域

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

发布评论

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

>www.elefans.com

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