How would I go about removing two directories with the following rule?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^/subdir/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /subdir/jadehttp.dll?Www_MySite&Action01=$1&H04=$2&cats=$3&states=$4 [L,NC]
Currently the friendly url successfully outputs to http://mysite.com/subdir/landingpage/1/packages/vic.
I want it to look like: http://mysite.com/subdir/packages/vic
Any ideas?
You have your existing rules, which are fine:
Then add these after them to account for 2 missing path nodes in the URL:
That rule will take a URL request like
http://mysite.com/subdir/packages/vicand internally rewrite it to/subdir/jadehttp.dll?Www_MySite&cats=packages&states=vic. The Action01 and H04 parameters are thus lost.You can embed some defaults, say for example:
replacing the
FOOandBARwith some default values. But since there’s nothing else in the URI to extract from, you can’t get those parameters from the URI. If they’re not part of the URI, there’s nothing else to extract them from.