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.

4
  • What happens when you try? Commented Dec 14, 2017 at 14:30
  • I'm pretty sure you need the URL Rewrite Module for IIS Commented Dec 14, 2017 at 14:30
  • Possibly duplication of stackoverflow.com/questions/38349759/… Commented Dec 14, 2017 at 14:30
  • When I try I get a 404, I downloaded and installed the URL rewrite module and unfortunately the problem persists. Thank you for the suggestion though! Commented Dec 14, 2017 at 14:39

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

6 Comments

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?
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.
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.
May I know what version of IIS are you using?
Yes, thanks again for your time. It is version 8.5.9600.16384
|
-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.

2 Comments

Have renamed test.blade.php to somethingelse.blade.php and altered my route file accordingly, unfortunately the problem persists. Thank you for the answer.
You try change route name from test to another. I think it is url problem. not view template filename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.