Question

I know this is quite old problem, but i have no luck when trying to find the right solution. I have tried every possible configuration but still no luck. I'm working on PHP project using laravel. I got no problem at all when set up the laravel.labs as vhost INSIDE the htdocs. But when I move it into separated folder which is C:\vhosts i got this 403 error. The purpose of vhosts folder is to hold multiple vhost. The following are my configuration:

System: windows 7 64-bit XAMPP v 1.7.7 Apache/2.2.21 PHP: 5.3.8

httpd.conf :

# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"

httpd-vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot C:/xampp/htdocs
  ServerName localhost
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot c:/vhosts/laravel_labs/public
  ServerName laravel.labs
</VirtualHost>

c:\windows\system32\driver\etc\host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1                   laravel.labs

.htaccess (inside the C:\vhosts\laravel_labs\public)

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Can anyone help to find something that i missed? any advice guys? thanks

Was it helpful?

Solution 2

Finally i found The answer for this problem. I have to add some lines in httpd.conf

Something like this:

Alias /laravel_labs/public "C:/vhosts/laravel_labs/public/"
<Directory "C:/vhosts/laravel_labs/public/">
    AllowOverride All
    Order Allow,deny
    Allow from all
</Directory>

See the detail explanation here : http://www.youtube.com/watch?v=Z250saioXIs

OTHER TIPS

Every time you add a new Alias or DocumentRoot, you need a <directory> section just like the one for your default DocumentRoot. Depending on your release, this either has something like

Order deny,allow 

or

require all granted
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top