Parallel CodeIgniter tasks and static HTML and htaccess

Cheers, everyone.

I am running CI in parallel to a static HTML site with a directory structure like this:

  • CI
  • static
  • user_guide
  • .htaccess
  • index.php

And I am using the following in my .htaccess file to get static files.

RewriteEngine On
RewriteRule ^(application) - [F,L]

DirectoryIndex /static/index.html

RewriteRule ^([a-z0-9_-]+)\.html$ /static/$1.html [L]
RewriteRule ^images/([a-z0-9_-]+)\.gif$ /static/images/$1.gif [L]
RewriteRule ^images/([a-z0-9_-]+)\.jpg$ /static/images/$1.jpg [L]
RewriteRule ^css/([a-z0-9_-]+)\.css$ /static/css/$1.css [L]
RewriteRule ^js/([a-z0-9_-]+)\.js$ /static/js/$1.js [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

      

I put my "assets" (images, css, etc.) in a static directory structure (since most of what I use from my CI views is borrowed from an existing site). Everything seems to work just fine except for one ...

If I want to include a JQuery plugin like:

<script src="../../js/jquery.autocomplete.js"></script >

      

This file will not be sent if I try to extract it directly from the browser address bar.

If I rename the file from "jquery.autocomplete.js" to "autocomplete.js" then that file MAY be retrieved via a request from the browser's address bar, but apparently won't load and function properly in my javascript (javascript stops execute exactly at the point where the autocomplete () function is called:

$("#fld").autocomplete("ajax/val", {
    width: 260,
    selectFirst: false
});

      

I've tried variations of the RewriteRule that applies to the / js directory and nothing seems to work, but I'm always in the dark in .htaccess. Can anyone please help?

This is the last one I tried and it doesn't work:

RewriteRule ^js/jquery\.([a-z0-9_-]+)\.js$ /static/js/jquery.$1.js [L]

      

Thanks for any help.

+2


source to share


1 answer


Here's the answer:



RewriteRule ^js/([a-z0-9_\.]+)\.js$ /static/js/$1.js [NC,L]

      

+1


source







All Articles