Aberidius Aberidius - 2 months ago 7x
CSS Question

CSS disappears with trail slash

I have a problem right now.

Whenever i have a trailing slash on my url, it leaves it without css.

I read a answer from another post that said that you should use the full url path instead of just

though, that didn't work for me.

How it looks with trail

I also use
for my css file.

echo '<link rel="stylesheet" type="text/css" href="css/style.css?'.filemtime("css/style.css").'">';

So how would i go with this?


Problem: First of all as @Marc mentioned, it is leading slash, when you add slash in browser after index.php/ then browser checks your css file as urlname.com/index.php/css/style.css.


  1. Either use full path
  2. Use rewrite rule to remove slash to avoid such issue.

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]