.htaccess的..更改域名 [英] Htaccess.. changing the domain name

查看:142
本文介绍了.htaccess的..更改域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的Joomla网站,从.COM转移到.eu域名。 该网站是在一个Web服务器。

I have a big Joomla website that was moved from .com to .eu domain. The sites are on one web server.

在旧的网站上有很多是直接指向oldwebsite.com/somethinghere~~V链接。

On the old website there are a lot of links that point directly to oldwebsite.com/somethinghere.

是否与旧域文件夹的.htaccess文件的方式来重定向 从oldwebsite.com/somethinhere到newwebsite.eu/somethinghere~~V?

Is there a way with Htaccess file in the old domains folder to redirect from oldwebsite.com/somethinhere to newwebsite.eu/somethinghere?

或者,也许一个办法做到这一点对新网站的文件夹?

Or maybe a way to do this on the new website folder?

感谢您, 克里斯。

推荐答案

有很多方法,有些人建议使用RewriteEngine叙述,但有一个更简单的方法:

There are many ways, some people recommend using RewriteEngine, but there is an easier way:

Redirect 301 / http://domain.eu/

这会自动处理域中的文件 - 例如,old.com/foo将被重定向到new.eu/foo~~V

This will automatically handle files in the domain -- for example, old.com/foo will be redirected to new.eu/foo

编辑:关于301,也就是code为永久重定向。此外,还存在临时重定向(我相信code为302),但它听起来像是你需要的正是这个 - 一个永久重定向

Regarding "301", that is the code for a permanent redirect. There also exist temporary redirects (I believe the code is 302), but it sounds like what you need is exactly this - a permanent redirect.

EDIT2:哦,而且我觉得可能需要经过domain.eu的/,但我不是100%肯定 - 不伤害它在那里,这是肯定的!我知道,因为我用的是同一种重定向的在生产网站。

Oh and, I think the / after domain.eu may be required, but I'm not 100% sure - doesn't hurt for it to be there, that's for sure! I know that because I use the same kind of a redirect on a production website.

这篇关于.htaccess的..更改域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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