Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xampp - Redirect external url to localhost

I use an installation of Xampp to test my files locally before I upload them to my web server. My web pages usually contain a lot of 'hardcoded' links, which means to test any links (or any forms etc) I need to change the hardcoded link to point to localhost, and then rechange it after I am done testing.

What I am looking for is a way to redirect an external url to point to my localhost folder, so I could set it as my website and then I would be able to make changes before I upload them. For example, if I were to enter 'www.mysite.com/example/view.php" in my browser, I would actually be looking at 'localhost/example/view.php'.

Is such a thing possible?

like image 840
Tom Avatar asked Apr 08 '09 09:04

Tom


1 Answers

Two solutions come to my mind:

  1. Use relative URLs (preferred)
  2. Add your external URL to your hosts file which can be found either in

    C:\WINDOWS\system32\drivers\etc\hosts (Windows)

    or

    /etc/hosts (Linux)

    Just add this line:

    www.mysite.com localhost

    Maybe you have to use your servers ip instead of mysite.com, I'm not sure right now

like image 121
scable Avatar answered Sep 21 '22 16:09

scable