Can't change Magento base URL, stuck in cache

后端 未结 5 1360
渐次进展
渐次进展 2020-12-06 08:51

I have just installed a live site onto a development domain. I changed the web/unsecure/base_url and web/secure/base_url fields in core_config_data

相关标签:
5条回答
  • 2020-12-06 08:59

    When you move or change your Magento installation to a new domain name, you need to do make sure of four things:

    1) Replace any instance of the old domain in any files on the server. This can be done on some (if not all) *nix by the following:

     find ./ -type f -exec sed -i ‘s/olddomain/newdomain/’ {} \;
    

    2) Remove the var/cache and var/session files.

    3) Update web/unsecure/base_url and web/secure/base_url in your database. (And any other instance of your domain - normally will not be more)

    4) But ultimately folders require permissions of 775 and files have permissions of at least 664. This can be done with the following *nix commands: (Note: var folder and sub may need higher permissions)

     find . -type d -exec chmod 775 {} ;
     find . -type f -exec chmod 664 {} ;
    

    A little history of how I found this out. Had to move a Magento website from one server to another. This was to test to make sure everything would transfer properly. After taking the hour to mass import the database (~3,970,000 rows - largest database I have seen for any CMS, and I have created/modified home-brew and other common CMSs), I was left with www.domain.com when I wanted developer.domain.com.

    0 讨论(0)
  • 2020-12-06 09:02

    Check your config.xml -- it probably has the live site database config.

    For Magento the path is /app/etc/config.xml but I'm not sure if that's the same in your version.

    0 讨论(0)
  • 2020-12-06 09:07

    when you change something always rm -rf var/cache/* if you change base url then regenerate all indexes as well

    0 讨论(0)
  • 2020-12-06 09:13

    This can lead to a situation where you've changed the base URLs in the Magento database, cleared cache (manual deletion of all mage-?? folders in var/cache), (cleared APC cache if you're running the op-code cache), (manually disabled the compiler (1.4.x.x and later)) and the system still looks for the original site.%

    0 讨论(0)
  • 2020-12-06 09:21

    If you don't have proper permissions on the var/ folders, Magento can write its cache information to the system /tmp folder.

    This can lead to a situation where you've changed the base URLs in the Magento database, cleared cache (manual deletion of all mage-?? folders in var/cache), (cleared APC cache if you're running the op-code cache), (manually disabled the compiler (1.4.x.x and later)) and the system still looks for the original site.

    Most people who own their own server discover that the site magically starts working after fixing, clearing and resetting permissions and then rebooting the server. The server reboot clears /tmp of the Magento cache files and Magento finally starts looking at its own configuration to find where it's located.

    Screen shots of this in action...

    The Magento directory found in /tmp...

    The Magento directory found in /tmp

    And the Cache living in that directory. Note the path -> /tmp/magento/var/cache

    Magento Cache subdirectories...

    For finding that misplaced cache directory, if you can install n98-magerun, use the command n98-magerun.phar sys:info to get a basic system info listing with one item being Cache Directory location.

    0 讨论(0)
提交回复
热议问题