Page 1 of 1

Redirect to XAMP (With hosts?)

PostPosted: 13. February 2016 23:19
by cobra-arbok
I wonder whether it is possible to redirect a website to XAMPP folder.

I would like to test a website with XAMPP without changing the URL.
So, by typing in the PC's browser the URL www.yyyyyyy.zz I would like to see the installed website in XAMPP.

I was thinking of changing the hosts file
Code: Select all
127.0.0.1 www.yyyyyy.zz

but I see the dashboard.

Thanks for your suggestions.

Re: Redirect to XAMP (With hosts?)

PostPosted: 14. February 2016 00:07
by Altrea
you have done everything correct.
Getting the Dashboard is the expected behavior because the index.php file in htdocs redirects to that Dashboard.

Re: Redirect to XAMP (With hosts?)

PostPosted: 15. February 2016 11:30
by cobra-arbok
Altrea wrote:you have done everything correct.
Getting the Dashboard is the expected behavior because the index.php file in htdocs redirects to that Dashboard.


So what should I do?
I should see localhost/appfolder.
If in the hosts file I write
Code: Select all
127.0.0.1/appfolder websiteaddress

It always opens the dashboard

I explain better my problem.

In the original website there is a lot of links pointing to the inside pages.
If they were dynamic (for example, /page/subpage) there would be no problems.
Instead these links point to the same site (www.website/page/subpage).

Now that I've copied the website in XAMPP I can not do the tests because those links lead me to the real external website.
I have to be able to address those links to the site in XAMPP.

Maybe to use hosts is not the right method.

Re: Redirect to XAMP (With hosts?)

PostPosted: 15. February 2016 13:19
by Altrea
cobra-arbok wrote:I should see localhost/appfolder.
If in the hosts file I write
Code: Select all
127.0.0.1/appfolder websiteaddress

no. The HOSTS file just do one task: translating a name to an ip. It cannot handle any folders or subfolders or route any of them.

What you should do is use Apache correct. Create 2 virtualhosts, one for localhost and one for websiteaddress. Both needs to have different DocumentRoot settings.

Re: Redirect to XAMP (With hosts?)

PostPosted: 15. February 2016 17:21
by cobra-arbok
Ok, Thanks