Jakub Szymsza
Jakub Szymsza

Reputation: 86

EasyPHP - localhost alias

I'm using the latest version of EasyPHP on Windows 10 and I would like to achieve one thing which I cannot find an answer to.

I achieve my projects for example like localhost/myproject. Everything is working but it's kind of annoying because my browser's (Google Chrome) autocomplete is kind of useless when all my projects start with localhost

I would like to achieve (probably through Apache config) the thing that when I type for example myproject.dev in my browser it shows me project localhost/myproject. Redirect would be enough but if it worked on the domain the whole time like it does on regular server that would be perfect. So basically I need something like ngrok but with custom domains and it does not need to be public.

It does not need to be automatic, I'm OK with setting each domain manually.

Upvotes: 2

Views: 1332

Answers (2)

mega6382
mega6382

Reputation: 9396

This can be easily achieved.

First add a new line inside hosts file, located at C:\Windows\System32\drivers\etc:

127.0.0.1       myproject.dev

Then locate httpd-vhosts.conf or httpd.conf and near the end add:

<VirtualHost myproject.dev>
    DocumentRoot "path/to/folder/myproject"
    ServerName myproject.dev
    ServerAlias myproject.dev
    <Directory "path/to/folder/myproject">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Upvotes: 3

Philipp Sander
Philipp Sander

Reputation: 10249

you want to create a Vhost

C:\Windows\System32\drivers\etc\hosts

https://www.cloudways.com/blog/configure-virtual-host-on-windows-10-for-wordpress/

Upvotes: 1

Related Questions