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??
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:
SELECT * FROM `jos_content`
WHERE `introtext` like '%mysite.gr%' or `fulltext` like '%mysite.gr%'
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:
find . -exec grep -iH "mysite" {} \;
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.
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)
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 -
RewriteCond %{HTTP_HOST} ^oldsite.com [NC]
RewriteRule ^(.*)$ http://www.newsite.com/$1 [L,R=301]
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.
An important thing to do when moving from one domain to another is to ensure that both the log_path
and the tmp_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 the administrator/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.