This is a guide to help you update your URL
after you move your site from one environment to another. For example
if you have your website on your localhost and now you want to publish
it. You will need to change your URL to reflect this.
You will need access you MySQL database and you can use MyPHPAdmin or MySQL workbench. Any tool that can access your database will work. There are quicker ways to find and update your domain in the database, but I will walk you through the safest way we can find.
REMEMBER TO ALWAY BACKUP YOUR DATABASE BEFORE YOU MAKE ANY UPDATES
You will need access you MySQL database and you can use MyPHPAdmin or MySQL workbench. Any tool that can access your database will work. There are quicker ways to find and update your domain in the database, but I will walk you through the safest way we can find.
REMEMBER TO ALWAY BACKUP YOUR DATABASE BEFORE YOU MAKE ANY UPDATES
Find Rows to update |
- select * from core_config_data where path = 'web/unsecure/base_url';
- select * from core_config_data where path = 'web/secure/base_url';
- select * from core_config_data where path = 'admin/url/custom';
If you have multiple store BE CAREFUL and note the config_id numbers for each row, that is how we will ensure that we can the results we want!
Each query will return something like this
‘261’, ‘default’, ‘0’, ‘web/unsecure/base_url’, ‘http://your.dev-domain.com/’
You need to note the first column which is your config_id, each id is unique and we can use that to update just the row we want to update. This will ensure you don’t update a wrong row or more rows than you wanted.
Let's update a row! |
The next step is taking each of the rows you want to change and updating them with your New URL.
*Here is something important to remember |
When you add your new row, remember to add your trailing ‘/’. If you
don’t do this your site will be completely screwed up and your CSS and JS will not work! NOTHING will work.
*Remember: I got my config_id from my original queries and I need to use
that to update my rows. If you are not sure of you config_id you can
double check by selecting the row with that config_id (this is like
measuring twice)
You can do this for each of your ID’s and you are set!
- update core_config_data
- set value = '/new.domain.com/'
- where config_id = 261;
- select * from core_config_data where config_id = 261
No comments:
Post a Comment