2

I have been invited to collaborate on a laravel 7 project and I have been able to set up the project locally on a windows 10 system using wamp server. While reviewing the project, I noticed the plan is to use subdomain routing. I am currently tasked with setting up the blade templates and I want to test the route but I can't get the route to work correctly even though the routes exist. This is what the routes look like enter image description here

When i try viewing the page for realestate by calling the url like this realestate.localhost:8000 I get the connection error below enter image description here

The route is inside routes/realestate.php folder and its using a closure

<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return 'Realestate Routes';
});

What is the right way to call the route in my local enviroment on windows?

Mena
  • 1,873
  • 6
  • 37
  • 77
  • 1
    that is not Laravel, you have miss-configured the server, the domain is not pointing to the laravel project – Alberto Sinigaglia Aug 18 '20 at 23:15
  • how would your computer know what host these domains (subdomains) are pointing to? – lagbox Aug 18 '20 at 23:20
  • @Berto99 this is in my development environment and not on a live serve. I am able to get to the welcome page using `http://localhost:8000` but have issues when trying to get `http://realestate.localhost:8000` – Mena Aug 18 '20 at 23:21
  • @lagbox I have no idea hence my reason for posting the question. – Mena Aug 18 '20 at 23:21
  • understood, i was thinking of something like a 'hosts' file perhaps – lagbox Aug 18 '20 at 23:43

2 Answers2

0

I'm not sure if your environment is different from mine, but make sure you're accessing via http:// and not https://

I just saw your Route code - it's been a long day, sorry :P Try reading up on Subdomain routing here.

Your Route should look like this:

Route::domain('realestate.localhost')->group(function () {
    Route::get('/', function () {
        return 'Hello, world!'
    });
    
    // all other routes for realestate.localhost go in here
});
Splashsky
  • 61
  • 8
  • I am accessing through http like so `http://realestate.localhost:8000` but not successful. However I am able to get to the home page using `http://localhost:8000` – Mena Aug 18 '20 at 23:19
  • Just updated my answer for you! Sorry I didn't see your route code before. :P – Splashsky Aug 18 '20 at 23:32
0

You need to edit your hosts and add redirect to localhost from your subdomain. see https://stackoverflow.com/a/56921347/11775360

Stano
  • 86
  • 4