Magento is automatically redirecting to localhost on live server

放肆的年华 提交于 2019-12-04 21:45:04

问题


I have uploaded my website on live server from localhost in magento

and when i m writing the url e.g: http://unbeatablewatches.com it is redirecting to localhost/unbeatable-watches..

how to solve this issue .. ?

please help me


回答1:


This occurs when the base link urls are not changed in the table core_config_data (records with the following path column).

web/secure/base_url
web/secure/base_link_url
web/unsecure/base_url
web/unsecure/base_link_url

You must clear the cache after changing them. This also occurs if the var/cache folder is not writable and the cache is written in the OS default tmp folder.




回答2:


You can use command

$ bin/magento setup:store-config:set --base-url=your.magento.url
$ bin/magento setup:store-config:set --base-url-secure=your.magento.url

to set site urls.




回答3:


You need to change urls in database.

Table core_config_data

You need to look for this values in path column:

web/secure/base_url
web/unsecure/base_url

And change their values to https://unbeatablewatches.com for secure and http://unbeatablewatches.com for unsecure.

I don't know if you have some access to the database, it would be good if you could use phpmyadmin.




回答4:


The answer that vasily-l posted is some what correct and worked for me.

However, protocols are required as per the magento documentation otherwise you will receive errors stating that the url is invalid. A trailing slash should also be used:

$ bin/magento setup:store-config:set --base-url="http://www.example.com/"
$ bin/magento setup:store-config:set --base-url-secure="https://www.example.com/"

The commands should be run from the magento root directory.

It is also best to note that these commands would be for Magento 2.x not Magento 1.x

Source: Magento DevDocs: Configure the store

PS: Didn't have enough rep to comment.




回答5:


Once I faced similar problem and the trick was I forgot to update local.xml files. I know it's old thread but if anyone runs into that.




回答6:


I faced this issue and solved it using following steps.

1. Change base_url

Navigate to the core_config_data table in your database and add your store url to the value column of following path column.

web/secure/base_url
web/secure/base_link_url
web/unsecure/base_url
web/unsecure/base_link_url

2. Clear log entries

Run following SQL query in order to truncate log tables.

TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;



回答7:


It was the same problem, fixed by changing in the database WHERE path='web/secure/base_url' AND path='web/unsecure/base_url' set scope_id=0 and scope=default

besides defining the url

SELECT * FROM magcore_config_data WHERE path='web/secure/base_url'
SELECT * FROM magcore_config_data WHERE path='web/unsecure/base_url'


来源:https://stackoverflow.com/questions/17639544/magento-is-automatically-redirecting-to-localhost-on-live-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!