php – Why is the style sheet not loading?


I'm trying to use urls amigáveis but I'm having some issues in the learning process. The problem now is that the page doesn't give me back the styles of the page.

Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteBase /
# RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^tratamentos/(.*) index.php?tratamentos=$1

I'm sending this url:

Question: Why doesn't index return the styles to me?


I think the problem is because you are using RewriteBase in your htaccess. And as the relative URLs are always calculated following the base URL, probably whenever you enter a page the base turns this page itself, breaking the CSS relative links.

There are some threads on the English stackoverflow from people who have had the same problem, I'll leave them here:

Consider adding the <BASE> tag to the head of your page, pointing to the root, always.

Scroll to Top