Base Url Change Magento2.1
I have changed Base url in Magento 2.1, but it does not works.
While installing I have set base url to
www.domain1.net. I need to change it to
What I tried:
Update baseurl in
SET value = 'http://www.domain2.net/'
WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url');
SET value = REPLACE(value, 'http://www.domain1.net/', 'http://www.domain2.net/')
WHERE path = 'design/head/includes';
Then changed Store Url
php bin/magento setup:store-config:set --base-url="http://www.domain2.net/"
php bin/magento setup:store-config:set --base-url-secure="https://www.domain2.net/"
Finally cleared the cache:
php bin/magento cache:flush
After serach www.domain2.net it throw server not found.
What is it the right way to change Base url in magento 2.1?
in addition to Sukeshinis answer I would also check what domain the magento-cookies are set for. Search in
%cookie% and remove all the rows or replace them with the new domain. Because if you don't change or don't delete these, then it could be that you will be redirected to your old domain. Wasted alot of minutes on that problem
First update both the
web/secure/base_url URLs in
http://www.domain2.net/ in your database, you can use the above query.
Then, clear the cache by the below command.
sudo rm -rf var/cache var/generation var/page_cache
Ensure you have updated your virtual host settings according to the new URL.
Once you set the applied the virtual host changes, restart the apache server.
Now, browse with the new URL.
In my case, I had to change the web/unsecure/base_link_url also:
-> SET value = 'http://www.domain2.net/'
-> WHERE path IN ('web/unsecure/base_link_url');
Redirected to store base URL instead of custom admin URL
In case of Custom Admin URL (in System -> [Advanced] Admin -> Admin Base URL) is set to something like http://mytreasure.store.com after creation of order or invoicing it Magento redirects back to the base url. I pin-pointed this to the store view change to the one order being assigned to But whatever this is a bug or misconfiguration I really wond...
Base url and Whatsapp button (script embed with secure and unsecure url)
I'm trying to integrate Whatsapp button on my magento website. I added the following code to my head.phtml I get the following console error when I visit secure url pages because .js url is always http:// Mixed Content: The page at 'https://www.mywebsite......' was loaded over HTTPS, but requested an insecure script 'http://www.mywebsite..../whatsa...
Base Url getting append in external url in header
I have a text field in System config, where url is put say wwww.facebook.com. Now when I am echoing the value from config in header it's giving me correct value. But when I am putting it in this code and printing it's giving url as www.mybaseurl.com/www.facebook.com Why is my baseurl getting append in front of that url? I am writing this code in he...
Base URL getting appended to end or URL and causing 404's
I have a magento installation (migration) which has been working fine and then suddenly it is adding the base url to the end of urls. I have checked the database base url entries - all fine I have checked the .htaccess file - all fine In fact changing these makes no difference whatever. I am unsure whether the host or the client has made changes, c...
Get frontend category URL in admin area with correct base URL
I try to load categories in the admin area with store specific values. This works so far, but I don't get the right base URL with $category->getUrl() if the given store has a different base URL than the admin store. I checked the Category::getUrl() method and found out that the store ID is used to determine the correct URL rewrite, but when it's...
Get Base Url Or Dynamic Url In view Js or html files
I figure it out to get dynamic url in the front end if I need I can simply define mage/url and the use it as url.build('<Modulename>/<controllername>/<action>/') When I tried the same thing for the backend it didn't return me the expected result. It gave the the current url and append the path which I had given. Can anyone explain...