阿帕奇非WWW到www重定向

编程入门 行业动态 更新时间:2024-10-24 09:27:25
本文介绍了阿帕奇非WWW到www重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个房贷计算器,似乎从mookal重定向网站并不www.mookal结果我的Apache配置如下:

I have a mortgage calculator site that doesn't seem to redirect from mookal to www.mookal My apache config is as follows:

RewriteEngine On ### re-direct to www RewriteCond %{http_host} !^www.mookal [nc] RewriteRule ^(.*)$ www.mookal/$1 [r=301,nc]

我是什么失踪?

推荐答案

使用重写引擎是解决这个问题的一个pretty重量级方式。这里有一个简单的解决方案:

Using the rewrite engine is a pretty heavyweight way to solve this problem. Here is a simpler solution:

<VirtualHost *:80> ServerName example Redirect permanent / www.example/ </VirtualHost>

然后你就会有另一个&LT;虚拟主机&GT; 第服务器名称www.example 为您真正的服务器配置。 Apache的自动preserves后,任何东西使用重定向指令,这就是为什么这是一个普遍的误解时, / 方法是不行的(而事实上它)。

And then you'll have another <VirtualHost> section with ServerName www.example for your real server configuration. Apache automatically preserves anything after the / when using the Redirect directive, which is a common misconception about why this method won't work (when in fact it does).

更多推荐

阿帕奇非WWW到www重定向

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

发布评论

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

>www.elefans.com

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