Apache的重定向:避免重定向循环 [英] Apache redirect:avoid redirect loop

查看:252
本文介绍了Apache的重定向:避免重定向循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法重定向到一个特定的目录。再说了,我键入www.example.com,我要被引导到像www.example.com/directory一个特定的目录。

I am having trouble redirecting to a particular directory. Say, I type in www.example.com, I want to be directed to a particular directory like www.example.com/directory.

我在Apache的配置文件添加到了我虚拟主机

I added this to my virtual host in my apache config file

永久重定向/ example.com/directory

Redirect permanent / example.com/directory

但它进入重定向循环,并在地址栏中的URL看起来像这样

but it goes into a redirect loop and the URL in the address bar appears like this

<$c$c>http://example.com/directorydirectorydirectorydirectorydirectorydirectorydirectorydirectorydirectorydirectory

我如何使尽快成立一个重定向作为URL example.com的人的类型需要他们example.com/directory~~V?

How do I set up a redirect so that as soon as a person types in the URL example.com it takes them to example.com/directory?

推荐答案

本替换你的重定向行:

RedirectMatch 301 ^/$ /directory/

这篇关于Apache的重定向:避免重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆