Why isn’t the style sheet being loaded?

Asked

Viewed 31 times

3

I’m trying to use urls amigáveis but I am having some problems in the learning process. The problem now is that the page does not return the page styles.

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:

http://dent.axitech.com.br/tratamentos/aparelhos-dentarios

Question: Because the index doesn’t return my styles?

  • How is the call of style links in html?

  • Whereas index.php understands that it is at the root of the site, thus .... <link rel="stylesheet" href="js/Slick/Slick.css? v=Ababqgov" />

1 answer

1


I think the problem is because you are using Rewritebase in your htaccess. And because relative Urls are always calculated by following the base URL, probably every time you enter a page the base turns this page itself, breaking the relative CSS links.

There are some topics in the English stackoverflow of people who have been through the same problem, I’ll leave them here:

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

  • Can you briefly explain to me the need for <BASE> ... I didn’t know about it. I already added the page :)

  • The base tag defines a base path for each page. Imagine that when you open any of the files of the site, it will first look at htacess to search the base of the URL, in this case you are rewriting it. The tag overwrites what you’ve modified

Browser other questions tagged

You are not signed in. Login or sign up in order to post.