Joomla,将整个网站移动到不同的域名
我有一个用 joomla 构建的网站,它在网上的网址为:
http://oldsite.com
我被要求将其移动到另一个网址 - 域名
http: //newsite.com
我应该如何正确地做到这一点而不搞乱网站和 joomla 安装?
I have a website built in joomla and it is live on the web at a url:
http://oldsite.com
I have been asked to move it to another url - domain name
http://newsite.com
How should I do this correctly without messing up the site and joomla installation??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在 Joomla 中没有找到任何对其运行所在域的引用,因此应该不需要更改任何内容。如果站点名称也发生更改,请更新 /configuration.php。
在实践中,您可能会发现您的内容中有一些带有完全限定域名的链接,您必须更改这些链接。类似以下的查询可以帮助您找到它们:
如果您使用的是 Linux,请从站点根目录运行以下命令,以确保代码中没有其他引用,例如模板或 CSS 中的硬编码图像路径等:
检查站点的 .htaccess 文件中是否有任何需要域名的自定义规则。
因此,问题被简化为更改现有站点的域,或创建新站点并在文件系统中移动 Joomla 安装,和/或创建数据库的副本。确切的步骤取决于您的环境。
I did not find any references in Joomla to the domain that it is running under, so there should be no need to change anything. If the site name changes as well, update /configuration.php.
In practice, you may find that there are links with fully qualified domain names in your content that you will have to change. Queries like the following can help you find them:
If you are on Linux, run the following from the site root directory to make sure that there are no other references in the code, such as hardcoded image paths in templates or the CSS, etc:
Check the .htaccess file of the site for any custom rules that require a domain name.
So the problem is reduced to changing the domain for an existing site, or to creating a new site and moving the Joomla installation in the file system, and/or creating a copy of the database. The exact steps depend on your environment.
除了cdonner所说的之外,您还需要修改configuration.php文件并删除对旧站点的所有引用
您还需要清空(缓存文件夹)
In Addition to what cdonner said , you need to modify the configuration.php file and remove all ref to the old site
You also need to empty the (cache folder)
您是否要将网站移至新的主机或帐户,或者只是更改域名?
如果您只是更改域名 -
您真正需要做的就是将旧域名指向同一个 Joomla 安装,并在 htaccess 中添加一条规则以将域名更新为新域名。这不仅修复了内容或模块中链接中的任何完全限定域名,还修复了旧域中可能存在的任何反向链接。以下是您需要添加到 htaccess 的内容 -
如果您要将站点移动到新主机,请按照 Hanny 的说明进行操作并使用 Akeeba 备份来移动站点。
在这两种情况下,您都需要确保旧域正在转发到新域,并且您已设置上述 htaccess 规则来修复任何可能损坏的链接。
Are you moving the site to a new host or account or just changing the domain name?
If you are just changing the domain name -
All you really need to do is keep the old domain name pointed to the same Joomla install and add a rule in htaccess to update the domain name to the new one. This not only fixes any fully qualified domain names in links within your content or modules, it also fixes any backlinks that might exist from old domains. Here is what you need to add to htaccess -
If you are moving the site to a new host, do as Hanny says and use Akeeba backup to move the site.
In both cases you will want to make sure the old domain is forwarding to the new one and you have the above htaccess rule set up to fix any links that might otherwise be broken.
从一个域迁移到另一个域时要做的一件重要事情是确保
log_path
和tmp_path
都反映新的服务器设置,并且它们都可由 Apache 写入。如果您不这样做,那么您可能会在登录服务器时遇到问题。您还需要确保 Apache 也可写入
cache
和administrator/cache
文件夹,因为如果您使用文件,Joomla 3.6.+ 会抛出致命错误缓存,这两个文件夹不可写。An important thing to do when moving from one domain to another is to ensure that both the
log_path
and thetmp_path
reflect the new server settings and that they are both writable by Apache. If you don't do that, then you will likely have problems logging in to the server.You will also need to ensure that the
cache
and theadministrator/cache
folders are also writable by Apache since Joomla 3.6.+ is throwing a fatal error if you're using file caching and these 2 folders are not writable.