I use Laravel in my web project. I have specified these routes for unauthenticated users.
Route::group(array("before" => "guest"), function() {
// Show the login page for the user
Route::get("/", array("as" => "homepage", function() {
return View::make("unauthenticated.login");
}));
Route::get("/account/login", array("as" => "account-login-get", function() {
return View::make("unauthenticated.login");
}));
});
If I access /
my page looks correct. If I try to accesss /account/login
, I don't get the stylesheets. I think this has to do with the rewrite. I use IIS on Windows Server 2012 and I have this kind of web.config file in the public folder.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Move to index.php">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I have two projects. In one of them this works but in the other it doesn't. What might be wrong with it?
Use the URL::asset()
to link to the stylesheet.
Because in /
it links to (for example) example.com/css/style.css
And if you're in /account/login
, it will look for the stylesheet in example.com/account/login/css/style.css
I use <link rel="stylesheet" href="{{ URL::asset('css/style.min.css') }}"/>
in my master blade template.
Hope it helps