[I need help] How to access my local website without..?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

[I need help] How to access my local website without..?

Postby TheSlider » 28. December 2022 03:52

Hi All,

Please help me.
I installed xampp and local WordPress on my PC.
I can access this website only if I type "localhost/" before the domain.
How do I get rid of this "localhost/" so I will enter the URL and the site will go up?

Currently, if I am not writing the "localhost/" word before the URL then I get the error:
"Not Found.
The requested URL was not found on this server.
Apache/2.4.54 (win64) openSSL/1.1p PHP/8.1.12 server at mywebsite.com Port 443"

So I must enter "localhost/mywebsite.com" and only then will the site go up.
I must remove that "localhost/".
How do I do that?

Thank you very much for any tip or direction.
TheSlider
 
Posts: 3
Joined: 28. December 2022 03:43
XAMPP version: V3.3.0
Operating System: windows 10 64bit

Re: [I need help] How to access my local website without..?

Postby Altrea » 28. December 2022 09:33

Hi,

you need to define a name based virtual host for mywebsite.com. you can do that in your /xampp/apache/conf/extra/httpd-vhosts.conf

just an example
Code: Select all
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/mywebsite.com"
    ServerName mywebsite.com
</VirtualHost>


Then you need to make sure that mywebsite.com can get resolved on your client pc, for example by editing your Windows hosts file.

And because you are using a CMS like wordpress, the new Domain needs to be configured in wordpress too. Best to install wordpress already from mywebsite.com url.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11934
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: [I need help] How to access my local website without..?

Postby TheSlider » 28. December 2022 20:13

WOW sounds great solution.
I will have the chance to try this out only next week.

Really hope it will work and will save me lots of troubles.
TheSlider
 
Posts: 3
Joined: 28. December 2022 03:43
XAMPP version: V3.3.0
Operating System: windows 10 64bit

Re: [I need help] How to access my local website without..?

Postby TheSlider » 05. January 2023 23:49

Altrea wrote:Hi,

you need to define a name based virtual host for mywebsite.com. you can do that in your /xampp/apache/conf/extra/httpd-vhosts.conf

just an example
Code: Select all
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/mywebsite.com"
    ServerName mywebsite.com
</VirtualHost>


Then you need to make sure that mywebsite.com can get resolved on your client pc, for example by editing your Windows hosts file.

And because you are using a CMS like wordpress, the new Domain needs to be configured in wordpress too. Best to install wordpress already from mywebsite.com url.



Hello,

I tried this and it doesn't work.
I still have to type 'localhost' host in the address bar to be able to run the local Wordpress website.
How do I avoid of typing the 'localhost'?

My goal is to be able to type in the address bar 'mydomain.com' and it will just run (after I edited the hosts file to point for 127.0.0.1 IP address).
TheSlider
 
Posts: 3
Joined: 28. December 2022 03:43
XAMPP version: V3.3.0
Operating System: windows 10 64bit

Re: [I need help] How to access my local website without..?

Postby Altrea » 06. January 2023 00:21

then you have forgotten something. It ist really just a combination of Windows HOSTS file, Apache virtual host and wordpress specific configuration.

You can find plenty of very detailed step by step tutorials on how to do so if searching for a combination of "Windows HOSTS virtualhost wordpress configuration". Just one example: https://www.cloudways.com/blog/configur ... wordpress/
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11934
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: [I need help] How to access my local website without..?

Postby Nobbie » 06. January 2023 10:49

Its not sufficient to edit httpd-vhosts.conf only. You also have to edit httpd.conf and remove the "#" (comment line) before the include statement for httpd-vhosts.conf. And finally restart Apache.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 151 guests