I am attempting to rewrite a link to this: http://www.foo.com/bar/baz

to

index.php?q=$1&d=baz

Where bar isn't a fixed value, but baz is.

  RewriteRule ^(.*)\/baz$ index.php?q=$1&d=baz [L,QSA]
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Things i have above kinda works but regrettably breaks all of the includes within the site (css/javascript) but oddly all of the pages work :/

This can be a drupal install, (therefore the second line must remain).

UPDATE

This may help really, i didn't remember to incorporate

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  **RewriteRule ^(.*)/details index.php?q=$1&details=true [L,QSA]**
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

It appears to do my rewrite properly, the only issue is it's disregarding another conditional claims now, i.e. will still be trying to rewrite files which exist (i.e. css,js) when it is mean to prevent them.

website is fine without my line (The main one using the stars), however with it, the variables and pages work, but static files like css etc will also be being rewritten....have to stop that!

Thanks ahead of time.

Shadi

Conditions only affect the very first rule rigtht after. So try copying the problem lines.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/details index.php?q=$1&details=true [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  RewriteRule ^(.*)/details index.php?q=$1&details=true [L,QSA]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

This is exactly what finally labored. it simply needed the ordering from the rules...