Forum Moderators: phranque
Can anyone help?
rewriteRule ^$ index.php?nav=p-1&clickpath=index [NC,L]
rewriteRule ^company/job-opportunities(/.*)?/?$ /mcms_page.php?nav=p-40&clickpath=company/job-opportunities&wildcard=$1 [QSA,NC,L]
[test.com...]
mod rewrite to say
index.php?page=1
My problem is that I use the following rewrite which seems to work on Unix systems but not on Windows Apache systems:
rewriteRule ^/?$ /index.php?page=1 [NC,L]
I think there is something wrong with my regex - can anyone help?
Alternatively, you could try rewriting requests for "index.php" instead; DirectoryIndex will rewrite "/" requests to index.php, and then mod_rewrite can rewrite index.php requests to index.php?nav=p-1&clickpath=index if those two query string parameters are blank.
Just realize that Apache modules execute one-by-one, each parsing your .htaccess file in turn for directives that it understands, and that there are several modules that can 'rewrite' the requested URL. Your mod_rewrite rules must take into account the actions of mod_dir, mod_alias, and even your php interpreter *if* they run before mod_rewrite does.
The order of execution of Apache modules is controlled by the *reverse* httpd.conf LoadModule list order in Apache 1.x and by a vaguely-described internal priority scheme in Apache 2.x.
Taking a shot in the dark, the following change *may* prevent two modules from interfering with each other and causing an 'infinite' rewrite loop:
RewriteCond %{QUERY_STRING} !nav=p-1
RewriteCond %{QUERY_STRING} !clickpath=index
RewriteRule ^$ index.php?nav=p-1&clickpath=index [NC,L]
[edited by: jdMorgan at 5:30 pm (utc) on July 10, 2006]