Support the ongoing development of Laravel.io →
Configuration Requests

Hi, i used route subdomain documentation http://laravel.com/docs/4.2/routing#sub-domain-routing

like this

Route::group(array('domain' => 'sub.localhost/jsm/public'), function(){

    Route::get('/user', function (){
        return 'ds';
    });
    Route::get('/', function (){
        return 'home sub domain';
    });
});

but when i request it in browser

it convert me to www.user.localhost/jsm/public

and i get error Server not found

information: i used xampp server

what i should do because this is first time i used subdomain

Last updated 3 years ago.
0

I would maybe check your .htaccess is correct.

0

i don't think because i didn't change any think in it and this is my .htaccess file

<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>

i think i should change my localhost setting to accept subdomain but i am not sure

Last updated 10 years ago.
0

OK Man, My problem solved as i expect by edit in host file in windows directory by adding this line to convert me to localhost

127.0.0.1 sub.localhost

thanks alot

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.