1

I've encountered a problem while creating simple apps with Laravel on IIS. When I create a new Laravel application I can see the Laravel welcome page just fine.

If I create another view in the same folder as the welcome.blade.php (test.blade.php for example), and set up the route for that in routes/web.php I can't navigate to that page in browser. EDIT: When I attempt this I get a 404.

My web.php is as follows:

<?php
Route::get('/', function (){
return view('welcome');
});

Route::get('/test', function (){
return view('test');
});

At first I thought that perhaps the project was not reading web.php, but when I run php artisan route:list the test route is listed.

I thought perhaps that my view didn't work, so I renamed it as welcome.blade.php and that loaded up fine. I just seem to be unable to add a route to any view or anonymous function that isn't mapped to welcome.blade.php

I tried adding a static route.php file into the app directory with the same code, but that made no difference to the result.

I'm sure I must be missing something basic, but I can't seem to put my finger on where I've gone wrong. Would massively appreciate any help you might be able to offer. Thank you.

sdheaven
  • 21
  • 4

3 Answers3

1

Right I worked out where I went wrong. I hadn't run artisan serve. Very simple.

If you're having this problem, try navigating to your application root in cmd and then try

php artisan serve

Then navigate to your page using that information.

Thank you to everyone who posted, massively appreciated.

sdheaven
  • 21
  • 4
0

You need to install Url Rewrite in your terminal. Then import the .htaccess file located in your project/public folder.

To install Url Rewrite, you need to install Web Platform Installer (WPI). Once installed, open WPI then search for the keyword "Url Rewrite", then install the first item in the result. Once the download is finished, Url Rewrite will be available in your IIS Manager

plmrlnsnts
  • 1,644
  • 12
  • 10
  • Thank you for this suggestion. I have Url Rewrite installed, how might I import that into the IIS Manager module? Is it a case of copying each rule manually through the gui? – sdheaven Dec 14 '17 at 15:56
  • Open your IIS Manager, then select your project. Url Rewrite should be available in the list of modules. Open it, then Import Rules must be available in the options found at the right side. – plmrlnsnts Dec 14 '17 at 16:01
  • I have the option to add rules manually, but not to import them. My actions read: Add Rule(s) View Server Variables View Rewrite Maps View Providers View Preconditions View Custom Tags Help Within add rule for inbound I can add a blank rule, a rule with rewrite map, request blocking. – sdheaven Dec 14 '17 at 16:04
  • May I know what version of IIS are you using? – plmrlnsnts Dec 14 '17 at 16:05
  • Yes, thanks again for your time. It is version 8.5.9600.16384 – sdheaven Dec 14 '17 at 16:06
  • No problem, Im already on my way home, and this is my way to kill time. Im pretty sure it's inside the **Inbound Rules** option. – plmrlnsnts Dec 14 '17 at 16:09
-1

I think IIS server maybe blocks test url. IIS server has such features.

Before time, I remember that I used IIS blacklist url feature.

You may check IIS url block feature.

rubyshine72
  • 132
  • 1
  • 6
  • Have renamed test.blade.php to somethingelse.blade.php and altered my route file accordingly, unfortunately the problem persists. Thank you for the answer. – sdheaven Dec 14 '17 at 14:41
  • You try change route name from test to another. I think it is url problem. not view template filename. – rubyshine72 Dec 14 '17 at 14:49