0

I have installed Magento 1.7.0.2 on my server and currently my store can be viewed at myurl.com/magento. I was hoping I could rename the magento folder to whatever I wanted to call my store, but it seems like that is not the case.

What is the best way to change the URL of your store?

3

URL is stored in the database in the table core_config_data. So if you move your Magento to another directory, you also need to update the database. Open the table and search for the rows where in the "path" column you can see:

  1. web/unsecure/base_url
  2. web/secure/base_url
  • Oh no! I did this and now I cannot view my site or log into the admin panel on either /magento or /my new store url – Raphael Rafatpanah Apr 16 '13 at 22:39
  • 1
    Don't forget the trailing slash on your url. – Glo Apr 22 '13 at 12:34
1

as the above answer states you need to update the core_config_data table within MySQL, To do this you can run the following SQL commands:

SELECT config_id FROM core_config_data WHERE path = 'web/unsecure/base_url';

Take the config_id from this sql query and add to the next one:

UPDATE core_config_date SET value = "new store url" WHERE config_id = replace with id above

repeat for the base URL and you should be good to go. Depending on what cache you have enabled you may need to clear these down as well.

  • Oh no! I did this and now I cannot view my site or log into the admin panel on either /magento or /my new store url – Raphael Rafatpanah Apr 16 '13 at 22:39
  • Any ideas? I would greatly appreciate it! – Raphael Rafatpanah Apr 16 '13 at 22:46
  • Just run the first SQL statement and check that the data in the value column is correct. E.g. mywebstore.com its important to have the http and the final forward slash. – James Cowie Apr 17 '13 at 6:15
1

The best way is to actually modify your DB dump prior to import and remove the var/cache and var/session directories.

So you'd first dump your DB, then use sed to replace URLs, then reimport.

sed 's#www.olddomain.com/magento#www.newdomain.com/newmagento' dbdump.sql 

For DB dumps, we strongly recommend using this script http://www.sonassi.com/knowledge-base/quicker-dumping-of-a-magento-mysql-database-for-branching/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.