title: CodeIgniter relative links without base_url()
body: <p>My site is on "localhost/mysite" but when I view it on the browser, layout and links are broken. CSS and JS files are on "localhost/mysite/themes/" but this is what I see in the source code:</p>
  
  <pre><code>&lt;link href="/themes/new/css/style.css" rel="stylesheet"/&gt;
  &lt;script src="/themes/new/js/scroll.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>And when I click on the links above, I always get to the following addresses and they are broken:</p>
  
  <pre><code>http://localhost/themes/new/css/style.css
  http://localhost/themes/new/js/scroll.js
  </code></pre>
  
  <p>"mysite" path is already missing. It should be:</p>
  
  <pre><code>http://localhost/mysite/themes/new/css/style.css
  http://localhost/mysite/themes/new/js/scroll.js
  </code></pre>
  
  <p>On htdocs\mysite\application\application\config\config.php, I have this setting and it should be left unedited.</p>
  
  <pre><code>$config['base_url'] = '';
  $config['index_page'] = '';
  </code></pre>
  
  <p>On htdocs\mysite.htaccess, I have this setting, and it's probably the file that needs changes.</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /mysite/
  
  RewriteCond %{REQUEST_URI} ^system.*
  RewriteRule ^(.*)$ /index.php?/$1 [L]
  
  RewriteCond %{REQUEST_URI} ^application.*
  RewriteRule ^(.*)$ /index.php?/$1 [L]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I looked around and tried all the suggestions by changing .htaccess but nothing really helped to make it work. It's funny when I change</p>
  
  <pre><code>href="/themes/new/css/style.css    
  </code></pre>
  
  <p>to</p>
  
  <pre><code>href="".base_url()."themes/new/css/style.css"
  </code></pre>
  
  <p>everything works perfectly. But this is not the solution. It's a big site and I shouldn't be editing too much files by adding base_url() function, etc. Maybe we can do something on .htaccess? :(</p>