Switch site to new domain

I have a site I’ve built on a hosted magento server. As I have a live site on another platform I purchased a new test domain name to build my site on.

Now I want to decommission my old site and transfer my new magento site to my original domain name.

Is this possible and if so how do I go about it.
Any help greatly appreciated

Andy

Hey @GiftedFox, I hope you’re doing well.

Is this post of any use to you (reference domains)? Also, I’m currently writing a tutorial on Magento Migration if that’s of any use. I’m hoping to have the video ready for tomorrow evening.

Thanks Craig.
I’ll look,forward to your video. When will we know it is up

Regards

I was supposed to have it up last week, but one thing lead to another and I ran out of time. Aiming for it to be up this week.

Hi Craig,
Just gone through your video.
When I enter the command php bin/magento setup:di:compile
I get this:
Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html[root@srv1 public_html]#
Any suggestions?

  • What version of Magento are you attempting to migrate?
  • What version of PHP do you have installed? (hint: run php -v from CLI)

It says V 5.6.4
But it is on the same server as my original so it should be v7.2.7
The original website still works ok
that’s strange

I just did php -v on my original public_html folder on the same server and it gives me v 7.0.33

Hosted Servers are very “quirky” compared to Dedicated Servers. But I’ll save that rant for another day :slight_smile:

So, on a Hosted Server each “environment” can be individually configured (up to a point). What you can do is have a “master” PHP version installed on the Server, whilst running other versions in their own environments for each customer.


Therefore, when you run php -v on the Server the output doesn’t always represent the version of your particular environment. I guess your PHP version is configured by either the Web Host or via your cPanel settings, so you’ll have to refer to their documentation.

To check the specifics of your actual environment, the best trick is to create a phpinfo.php file (as mention here). Just pop it in your working directory and load it in a browser. The results will be specific to that installation directory.

I hope this makes some sense?

Anyway, when you work out how to configure your specific environment then that should solve your problem.

Many thanks for the help Craig,
I’ve been on the host company and they have fixed the issue and the website now loads.
The problem I have now is that everything I click on (categories or products) I get this error

Not Found

The requested URL /personalise-ceramic-mug-glitter-cartoonme-6.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Cool.

Are you saying the Homepage works but the links don’t? If so, go through these 7 steps:

  1. find var generated vendor pub/static pub/media app/etc -type f -exec chmod u+w {} + && find var generated vendor pub/static pub/media app/etc -type d -exec chmod u+w {} + && chmod u+x bin/magento
    
  2. rm -rf pub/static/adminhtml pub/static/frontend
    
  3. bin/magento setup:di:compile
    
  4. bin/magento setup:static-content:deploy en_GB en_US
    
  5. bin/magento cache:flush
    
  6. bin/magento indexer:reindex
    
  7. bin/magento cache:clear
    

**Replace en_GB and en_US in Step 3 with your appropriate languages.

Any one of those steps might solve your issue, but you may as well run them all in order just to cover your bases.

Cron Tasks
One thing that I never covered in the Tutorial is setting up Cron Tasks on the new server that you migrate to. Run this as well. I’ve updated the supporting post.

php bin/magento cron:install

Ok.
ran all those commands but still getting the error.
When I go to the original site the homepage loads and when I click on a link I get the same error but I noticed that the URL reverts to the new domain.

The new website URL in question is www.thegiftedfox.co.uk

Are you moving sites or creating a development environment (copy)? If you’re just creating a copy then your original site should be be effect because you’ve not done anything to it.

Did you update the 2 values of the Database in copied version after migrating it?

Did you definitely add the “/” at the end of the URL when you changed it in the database?

slash_after

Yes I changed the 2 base URL’s to the new domain name.
web/unsecure/base_url http://thegiftedfox.co.uk/
web/secure/base_url https://thegiftedfox.co.uk/

I did manage to get in to admin panel briefly and the base URL’s in there were still the old test one’s but I’ve checked the database and it definitely says the new.

Here is what I did.

Designed a website using WWW.thegiftedfoxtest.co.uk on a hosted server following your brilliant tutorial. I already had a live website on WWW.thegiftedfox.co.uk.
Once I had created the website and everything was working I wanted to close down my live website and move the newly created Magento site on to www.thegiftedfox.co.uk
I created a new account in cPanel using the www.thegiftedfox.co.uk domain
I then copied the entire contents of public_html from the test domain to the live domain.
Then exported the database from the test domain and imported it in to the new domain. and changed the base URL’s in the new database. Also added database credentials to app/etc/env.php.
The name servers were changed in GoDaddy for the domain www.thegiftedfox.co.uk to use the new site.

I have disabled maintenance mode on the two sites so you can have a look at the problem
Sorry for all the fuss but I hope someone else learns from my issues

Ok, gotcha. I’m just looking at the site now… I’ve seen this before!

You don’t have Apache setup correctly. You see, you can load all of your URLs so long as you put in “index.php” after the domain:

http://thegiftedfox.co.uk/index.php/personalised-cartoonme-marble-latte-mug.html

Do you have mod rewrite enabled on this server environment? You would normally set this by running sudo a2enmod rewrite but you might have to get your Web Host to set this as your in a Shared Environment and probably don’t have the premissions.

What directory do I need to be in to run this command.
I’m getting -bash: a2enmod: command not found

It’s a server command, so any. You just need to have superuser or root privileges on the user that you execute the command as.

I’m logged in as root.
I’ll have to log a ticket with the web hosts

On a side note… I like your site. There’s something to be said for a boxed-layout. My monitors run on a resolution of 1440x2560, so sites that take up the whole screen make my eyes explode. Another thing that I love you haven’t done (unless you plan to) is:

  1. Throw intrusive pop ups in the viewers face
  2. Have one of those annoying widgets that popup every-so-often with “Bill just bought xyz”

Your colour scheme is also really easy on the eye!

My only 2 pieces of constructive criticism (if you don’t mind me saying) are:

  • Product specifications should stand out more (e.g. dimensions). Whether you put them in their own paragraph or make them bold, it just makes it easier to scan for that type of stuff.
  • Displaying Delivery/Returns links somewhere “above the fold” on product pages. I’ve found this to increase consumer confidence when shopping on sites they’re never been on before.