2

I get my localhost URL of my Magento store on some parts of my site

So when I open the website (now on a live server) I get the URL I want but when I check links in my footer I'll get the localhost URL (from my home pc where I created the store).

The sites are loading correctly but I don't want my Localhost URL show in the browser navigator. How can I fix this ?

1 Answer 1

2

There isn't QUITE enough information here to give you a correct answer with 100% certainty because footers can be created & embedded in your theme template in Magento in several ways:

  1. Created as a CMS Static Block
  2. Created as a .phtml / .php source code file

In the first case, the most likely scenario is that you created the CMS block on your local development system and the URL used a hard-coded value for the URL instead of a relative URL. To remedy this situation, open up the Static Block being used as the footer and edit the links so that they use relative URLS instead of a full URL:

Change <a href="http://localhost/some/link/">Some Link Here</a>

To <a href="/some/link/">Some Link Here</a>

If the footer is being generated using a .phtml / .php file, open that file in your code editor and make the same change.

If you copy and paste URL's (or HTML) from your browser into the Magento CMS WYSIWYG editor it will usually use the fully-qualified URL, which as you've discovered includes the "localhost" as the base of the URL. Same thing happens when you copy and past URL's into your source code editor when modifying .phtml / .php files.

If you edit the URL to use a relative link (stripping off the http://localhost portion of the URL) your web server will determine the base URL automatically.

2
  • Thank you for the answer & the edit. The weird think is, when I'm trying to access the landing page after I visited the footer link - I will got my old localhost URL instead of my new URL which worked before fine. How is this even possible after I changed the URL in the database. Commented Dec 11, 2015 at 17:27
  • 1
    However this answer was the right answer. Always check if links are relativ. Thank you sir Commented Dec 11, 2015 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.