Forum Moderators: phranque
I've just started using mod_rewrite and it has been absolutely fine, until i tried accessing the following SSL url: [mysite.com...]
Apache ReWriteRule in apache2.conf:
ReWriteRule /Content/([A-Za-z0-9]+) /mysite.com/www/index.php?mode=contentpage&PageID=$1
P.S. this exact same rule works absolutely fine when i do [mysite.com...]
Welcome to WebmasterWorld!
We've had a spate of "weird" problems discussed recently, where it was reported that "mod_rewrite doesn't work with <insert other module name here>". In most cases, this had to do with the module load order in httpd.conf.
Apache modules are processed in reverse order from that indicated by the LoadModule directives -- Those listed first in the httpd.conf LoadModule list are processed last. So if mod_rewrite appears in the load list *before* another module, say mod_SSL or mod_php, then it won't be processed until *after* that module runs (if ever).
Since this is 'an easy fix' you might want to check this first.
Jim
I'd appreciate any other ideas because i can't really get on with a large part of my site that relies up on mod_rewrite working in SSL mode.
There are a couple of subtle problems with your RewriteRule, but they may not have anything to do with this problem. First, there are two common forms of RewriteRule, internal rewrites and external redirects. For internal rewrites, only a local URL-path should be specified, and for external redirects, a full canonical URL should be specified. In addition, your server performance will be improved by specifying start and end anchors for your pattern if possible, by using the [NC] (no-case) flag to make the pattern compare case-insensitive, and by using the [L] flag unless the output of the current rule, once invoked, needs to be further processed through the subsequent rules.
So, I'd suggest something like this:
RewriteRule ^/Content/([a-z0-9]+) /index.php?mode=contentpage&PageID=$1 [NC,L]
RewriteRule ^/Content/([a-z0-9]+) /index.php?mode=contentpage&PageID=$1 [NC,T=application/x-httpd-php,L]
Jim
However i had left the default DocumentRoot directive in this file to /var/www/.... but my document root is elsewhere, so a quick change of path and all sorted.
I found this out from the mod_ssl logs i didn't know got created in the /var/log/apache2/ directory. Thanks for your time.
Kind Regards
Mark Rawson