Welcome Guest, Not a member yet? Register   Sign In
Mod_rewrite, /controller/function, and CSS/JS
#1

[eluser]underskor[/eluser]
Would someone care to explain how to use mod_rewrite, with /controller/function/argument URI's while allowing CSS/JS/images to continue functioning?

Using the .htaccess sample provided on the forums/wiki seems to get me as far as /controller - awesome - but once I go into /controller/function, I lose my stylesheets etc. I imagine they are being rewritten to /controller/function/css/style.css, but I can't figure out how to stop that.

My current .htaccess:
Code:
RewriteEngine On

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

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

RewriteCond $1 !^(index\.php|css)
RewriteRule ^(.*)$ index.php/$1 [L]

I think my problem is that I do not understand the last RewriteCond fully. I think it's something like 'apply the following RewriteRule if the pattern in RewriteRule is not 'index.php' or 'css'. I've tried changing 'index.php|css' around but had no luck. Would be great if someone could explain it for me.

Directory structure (FWIW):
Code:
/public_html
  index.php
  /css
    style.css
    /imgs
      img.gif
    /dir
      style.css

Thanks!
underskor


Messages In This Thread
Mod_rewrite, /controller/function, and CSS/JS - by El Forum - 01-10-2009, 07:10 AM
Mod_rewrite, /controller/function, and CSS/JS - by El Forum - 01-10-2009, 12:00 PM
Mod_rewrite, /controller/function, and CSS/JS - by El Forum - 01-10-2009, 04:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB