I am new to .htaccess and I'm using it to pass variables between web pages using 'virtual' pages. I very longs lists and add hrefs to virtual pages for each row. The parameters are then picked up by .php to retrive the selected record from a Mysql Database.

I have an MVC type setup with my main PHP page (wHazLog.php) in the "wHazLog" folder of my appache web server. I have all my .php, .css, .js, .html (templates), files within an "inc" subfolder.

All my .php files containing classes are loaded at the begining of wHazLog.php using require\_once. With the exception of some ajax .php files, which have to re-include the nessessary classes.
My .htaccess file looks like this (there are more rules but they are the same format):

```
RewriteEngine Off
RewriteEngine On

#view all hazards in selected safety case
RewriteRule ^(safetycase)/([^/]+)\.html$ wHazLog.php?pgtyp=$1&scid=$2 [L]

#add hazard to selected safety case
RewriteRule ^(safetycase)/([^/]+)/add\.html$ wHazLog.php?pgtyp=$1&scid=$2 [L]

#view/edit selected hazard
RewriteRule ^(hazard)/([^/]+)\.html$ wHazLog.php?pgtyp=$1&hid=$2 [L]

#add control measure to selected hazard
RewriteRule ^(hazard)/([^/]+)/add.html$ wHazLog.php?pgtyp=$1&hid=$2 [L]

#edit/edit control measure
RewriteRule ^(controlmeasure)/([^/]+)\.html$ wHazLog.php?pgtyp=$1&cmid=$2 [L]

```

The login, and main pages which just use form submissions to pass data between pages are all fine:
www./wHazLog/wHazLog.php

When I start using pages which rely on the MOD Rewrite such as:
www./wHazLog/hazard/hid=776
I have to start prefixing the include urls with; "../".

This is getting quite complicated to figure out for each page, is there an easier way to set my include path and have it modified depending on the MOD Reqrite rule being used?