José Luna
José Luna

Reputation: 69

css styles break on certain url path

www.domain.com/informe works fine, but when I enter to www.domain.com/informe/:documentid , all my css styles breaks because the page is looking for the public folder in www.domain.com/informe and not in the base url. Also, i have the same problem in localhost.

I am using Limonade php because is lightweight and templating is fast, also deploying it is really fast as well.

This is my index file:

<?php
require_once 'lib/limonade.php';
echo $root_dir;
option('base_path',          $base_path);
option('base_uri',           $base_uri);
option('root_dir',    $root_dir);
option('public_dir',  $root_dir.'/public/');

and my default_layout.php file reference the css files like this:

<link rel="stylesheet" href="public/css/bootstrap.css">

also my .htacces file looks like this:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  Options +Indexes
  RewriteEngine on

  # if your app is in a subfolder
  # RewriteBase /my_app/

  # test string is a valid files
  RewriteCond %{SCRIPT_FILENAME} !-f
  # test string is a valid directory
  RewriteCond %{SCRIPT_FILENAME} !-d

  RewriteRule ^(.*)$   index.php?uri=/$1    [NC,L,QSA]
  # with QSA flag (query string append),
  # forces the rewrite engine to append a query string part of the
  # substitution string to the existing string, instead of replacing it.
</IfModule>

Does anyone know about a similar and better microframework for this kind of little projects where I need only to consume an api or know how to solve this problem please.

Upvotes: 1

Views: 53

Answers (1)

Arnab
Arnab

Reputation: 961

Use it like bellow

<link rel="stylesheet" href="/public/css/bootstrap.css">

It will then start searching from the root folder

Upvotes: 1

Related Questions