Laravel 4 Virtual Host and mod rewrite setup

后端 未结 3 959
天命终不由人
天命终不由人 2021-01-05 00:01

I\'ve been trying for a few hours to install Laravel 4 and make the Virtual Hosts and Routing work but so far I\'ve been unlucky. I\'m mentioning that I\'m doing this on a <

相关标签:
3条回答
  • 2021-01-05 00:39

    Try turning on AllowOverride All on the directory by changing your VirtualHost to:

    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/laravel/public"
        ServerName laravel.dev
        ServerAlias www.laravel.dev
        <Directory "c:/wamp/www/laravel/public">
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
    0 讨论(0)
  • 2021-01-05 00:41

    I have gone through the same issue and followed the all the treatments given above but virtual host can not be set.

    When I inspected file http.conf then I found that inclusion of file httpd-vhosts.conf was commented as given below. Make sure to include httpd-vhosts.conf in httpd.conf.

    #Include conf/extra/httpd-vhosts.conf

    I have removed the # comment. Restarted the wamp and it was working.

    Include conf/extra/httpd-vhosts.conf

    0 讨论(0)
  • 2021-01-05 00:43

    If the htaccess file that you posted was in your /public/ folder, then that's why you're getting a 500 internal server error. That htaccess file was made for the folder that the /public/ folder is in. But since your public folder is the document root, you don't need it.

    The htaccess file in the /public/ folder should look like this:

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    

    (for WAMP).

    0 讨论(0)
提交回复
热议问题