0

When using mod_rewrite, I'd like to know if there is a possible, flexible way to globally set the current working directory as root, so stylesheet/image paths won't break when passing parameters via mod_rewrite:

I currently use define("PATH", "/subfolder/"); of which I place at the beginning of each link href/src, but I'm thinking there has to be a more flexible way of doing this.

EX:

stylesheets/styles.css works when no parameter is being passed, but breaks when a mod_rewrite parameter is in use.

Any Suggestions?

Sammitch
  • 30,782
  • 7
  • 50
  • 77
Matt Himsl
  • 49
  • 5

1 Answers1

0

The first two RewriteCond rules here exclude URLs that match a file or folder that physically exists.

RewriteEngine on

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

RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]

Or by adding explicit exclude rules to your mod_rewrite directives.

Community
  • 1
  • 1
Sammitch
  • 30,782
  • 7
  • 50
  • 77