Search code examples
.htaccessmagentourl-rewritingmagento-1.8

Magento redirect to homepage after changing base url to www?


My old base url was http://mensstore.biz/ . I changed it to http://www.mensstore.biz/ . But when I access my inner pages like /generics.html with old url without www,it redirects to home page. I want if user enter www or without www it must remain on the same page. Any ideas?


Solution

  • It can issue for htaccess.

    Step1:find htacess RewriteEngine on the added below for Redirecting non-www to www url

    RewriteCond %{HTTP_HOST} !^www\.mensstore\.biz
    RewriteRule (.*) http://www.mensstore.biz/$1 [R=301,L] 
    

    OR

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    

    Step 2:Goto your database and then go to core_config_data there search

    SELECT * FROM `core_config_data` WHERE `path` LIKE '%secure/base_url%'
    

    run the query and if you find any record have http://mensstore.biz/ then change http://www.mensstore.biz/

    and
    SELECT * FROM core_config_data WHERE path LIKE "%secure/base_link%" run the query and if you find any record have http://mensstore.biz/ then change http://www.mensstore.biz/