I’ve spent some time on Google and SO trying to figure this out and I have now had to resort to asking yet another mod_rewrite question….
I am using mod_rewrite and for the most part it works fine.
The part I am having problems with is:
# Load pages for health-it while keeping the URL masked
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^health-it/([-a-z0-9]+)/? /health-it/loadPage.php?p=$1 [NC,L]
I have a URI that I want:
/health-it/aimsconsultant
The problem is, mod_rewrite is doing this:
/health-it/aimsconsultant/?p=aimsconsultant
The page still loads but the URI is the issue.
/health-it/aimsconsultant/
Works as expected. It should be noted that /health-it/aimsconsultant is a directory and maybe this is the cause? I believe that Apache redirects to append the trailing slash for directories but why is it appending the query string?
It works perfect for internal pages (no directory for internal pages):
/health-it/aimsconsultant/manufacturer-signup
and
/health-it/aimsconsultant/manufacturer-signup/
work properly.
The only issue is on the first level… This makes no sense to me and I am baffled as to why this is happening. Please, can someone enlighten me on how to fix this and why this is working in this manner?
Thanks for your help
OK, sorry, I misread the ? for a $ !
Tried adding this, it seems to to the job:
By default, it’s On, and that’s why when Apache tries to get the canonical representation of your URL, it falls back onto the directory.