Reputation: 871
The problem is that when I add a trailing slash at the address bar url localhost/register.php/
the CSS dissapears (is not applied anymore). CSS is in a separate file in a separate dir. Here is the structure:
CSS is invoked in header.html
with <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
header.html
is included in index.php
with include 'includes/header.html';
Running apache under Windows 7.
Upvotes: 3
Views: 3175
Reputation: 349012
When a trailing slash is added, your browser assumes register.php
to be another directory, rather than a file. When relative URLs are specified, the external resource will be sought relative to the subdirectory register.php/
(because of the slash).
Example:
css/style.css
> http://localhost/css/style.css
css/style.css
> http://localhost/register.php/css/style.css
.Fixing
To fix this issue, make use of absolute URLs. Either of the following:
<link href="/css/style.css" ... />
<link href="http://localhost/css/style.css" ... />
<base href="/register.php" />
(this tag has to be specified within the <head>
Upvotes: 8