How to assemble a basic Virtualhost to rewrite Urls in my Xampp htdocs project

Asked

Viewed 72 times

0

Following the model proposed in the file itself httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

2 answers

1

Duplicate this line and set up as you need in the Httpd-vhosts.conf file. Don’t forget to enable the vhost module in Httpd.conf, release Listen to the port of the new virtual host q vc configured (these lines are sometimes commented with #).

Watch out for the lines below:

Filing cabinet Httpd.conf:

Listen 81
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf

Restart your XAMP

0


Would that be:

<VirtualHost projeto:80>
    ServerAdmin webmaster@projeto
    ServerName projeto

    DocumentRoot "C:/xampp/htdocs/projeto"
    <Directory C:/xampp/htdocs/projeto>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>
    </Directory>

</VirtualHost>

Then add the name "project" to your host. How are you in Windows environment: C: Windows System32 drivers etc hosts

   127.0.0.1     projeto

Browser other questions tagged

You are not signed in. Login or sign up in order to post.