繁体   English   中英

网址重新打印从www.example.com到www.example.com/beta

[英]URL rewrinting from www.example.com to www.example.com/beta

他的朋友,目前我的网站设置在我的根目录中的“beta”文件夹中

www.example.com/beta

现在,如果有任何用户输入以下URL

www.example.com

然后他应该自动重定向到第一个URL,任何想法? 我知道这可以通过.htaccess完成,但我不确定:(请帮帮我。谢谢

尝试添加

Redirect 301 / http://www.example.com/beta

到根目录中的.htaccess文件(未经测试)

您可以在“ 不使用重写”的顶部找到一个很好的例子,这是一个每个人在编辑.htaccess文件的一个字符之前应该阅读的页面。

RewriteRule ^/(.*) http://other.example.com/$1

# is better expressed as..
Redirect / http://other.example.com/

或者,在你的情况下,

Redirect / /beta/

实际上你可以做到非常简单(不需要.htaccess修改)。

从服务器主管理器(/)编辑index.html文件的标头。

<HEAD> ... </HEAD>部分中添加重定向代码,例如:

<meta http-equiv="refresh" content="0;URL=http://www.example.com/beta/somepage.html" />

请注意,这应该位于主dir /的index.html内。

有关参考,请参阅: http//devmain.blogspot.co.uk/2013/06/html-auto-redirect-website-to-different.html

希望它有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM