Apache Mod Rewrite For Laravel

后端 未结 5 1962
野趣味
野趣味 2020-11-29 05:26

I have an installation of Laravel on Wampserver. The directory is as follows:

C:\\wamp\\www\\laravel

Now URLs are like this:

http://localhost/

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 05:57

    I finally figured a way out. First of all, I had to open and edit my Apache httpd.conf by selecting it from the Wamp Aestran tray menu. The I had to uncomment the line

    #Include conf/extra/httpd-vhosts.conf

    After that, I opened the file which is located at the

    /bin/apache/apache.x.y.z/conf/extra/httpd-vhosts.conf

    then I added the following lines.

    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    
    
    
        DocumentRoot "C:/wamp/www"
        ServerName localhost
        Options Indexes FollowSymLinks
        
            AllowOverride All
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1
            #If you want to allow access from your internal network
            # For specific ip addresses add one line per ip address
            #Allow from 192.168.0.100
            # For every ip in the subnet, just use the first 3 numbers of the subnet
            #Allow from 192.168.0
        
    
    
    ## must be first so the the wamp menu page loads when you use just localhost as the domain name
    
    
        DocumentRoot "C:/wamp/sites/laravel/public"
        ServerName laravel.dev
        Options Indexes FollowSymLinks
        
            AllowOverride All
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1
            #If you want to allow access from your internal network
            # For specific ip addresses add one line per ip address
            #Allow from 192.168.0.100
            # For every ip in the subnet, just use the first 3 numbers of the subnet
            #Allow from 192.168.0
        
    
    

    The next step was to edit my hosts file at C:\windows\system32\drivers\etc

    and added

    127.0.0.1 laravel.dev

    Then restarted Wamp and it worked. Thanks to you guys for pointing me in the right direction. Really Appreciate it

提交回复
热议问题