简体   繁体   中英

WAMP Sub domain routing with laravel

I am using laravel 5.1 & WAMP server 2.5.

I have my domain like 'www.example.com' which is pointing to the root. where else I have a subdomain like 'admin.examle.com'.

Route::group(['prefix' => 'app', 'middleware' => 'authentication'], function () {
        Route::get('home', ['as' => 'app.home', 'uses' => 'DashboardController@home']);
    });

I have added virtual hosts on httpd-vhosts.conf as below:

<VirtualHost *>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot "C:/wamp/www"
</VirtualHost>

<VirtualHost *>
    ServerName example.com
    DocumentRoot "C:/wamp/www/app"
    ServerAlias app.example.com
</VirtualHost>

But as app is not an actual folder in my www folder it is showing internal server error. Can anyone help with this ?? I need to use subdomains for the same.

  • Check your DocumentRoot, all Laravel applications should be pointed towards public directory, where the index.php file is located
  • Check your hosts file (I'm a Windows user myself) , this file allows web browsers to point domains towards specific IPs (For instance, using mysubdomain.myapp.local). To read more about hosts file http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM