Question

I'm having trouble trying to rebuild my dev environment.

I've installed XAMPP and followed these steps:

  1. Backup MYSQL DB.
  2. Backup Home Directory.
  3. Create DB with same user/dbname
  4. Imported SQL file successfully, and imported home directory (and invisible files) into htdocs.
  5. Verified that base_url and secure_base_url are set to "http://magento.local" (I have tried http://127.0.0.1, also)
  6. Deleted all Cache/Sessions

How can i get http://magento.local to just display my local website, instead of reverting to the live URL?

I have edited my base_urls, and even the cookie url.

Was it helpful?

Solution

The way I always do it is as follows...

Search the core_config_data table for ANY fields that are URLs, which you can do by running...

SELECT * FROM core_config_data WHERE value LIKE 'http%'

..or simply using phpMyAdmin if you have it available. One of our main sites has a total of about 8 rows to be updated (possibly not all required, could be left from older versions it was running on). If you see your live URL simply change it out for your local address.

Then open you cache folder and delete any files starting with mage--*. The thing that normally ends up catching me out at this point is file permissions. I don't know what OS you are using, so I can't tell you how to check, but if the apache user doesn't have write permissions to the cache folder the first time you accessed the site, Magento creates most of the files normally created in the DOCUMENT_ROOT/var folder in the OS's temp directory. For example, we use Mac OSX at work, it will create the cache files in /tmp/magento/, upon deleting that directory you should be good to go.

NB: You should probably update the file permssions of the var directory before viewing the site again, otherwise it will keep writing to the temp directory, which will trip you up again in the future.

OTHER TIPS

Magento is loading, noting that the URL you're using is not the same as what's configured, and redirecting you.

Here are the steps to edit the base URL in the Magento config.

I'm guessing you need to clear the Magento cache mentioned there.

Have you checked your htaccess file?

If your local magento store url is like http://magento/ then your Magento dont work, but if your url is like http://magento.local/ - magento store will be working fine.

I'd try clearing your Magento cache to start. Also note that some browsers cache redirects, so try accessing the site in a different browser or clearing the browser cache.

make sure you have set the base_url .you can actually edit it in the phpmyadmin look for the table with 'config_data' on its name.

localhost/text.html = test.html [correct]

of course it will be correct since it doesn't pass through the 'index.php' which works as the controller. remember that magento uses clean urls too.

www.yourdomain.com/index.php/name_for_the_page/

If your core_config_data is right, then this is very likely an issue with your local.xml file. Be sure your database information being supplied to this file is correct.

httpdocs/app/etc/local.xml

<default_setup>
        <connection>
            <host><![CDATA[localhost]]></host>
            <username><![CDATA[your_username]]></username>
            <password><![CDATA[your_password]]></password>
            <dbname><![CDATA[your_db]]></dbname>
            <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
            <model><![CDATA[mysql4]]></model>
            <type><![CDATA[pdo_mysql]]></type>
            <pdoType><![CDATA[]]></pdoType>
            <active>1</active>
        </connection>
 </default_setup>

In this case your core_config_data is just fine, it's just not using the right core_config_data table. I ran into this same problem when my staging database was named differently than my local. A simple "Oops!" mistake.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top