You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Galella, Anthony" <an...@intel.com> on 2002/12/23 21:21:02 UTC
[users@httpd] Need help to get mod_rewrite to behave the way I want it to:)
This is my setup:
Operating System: FreeBSD 4.5
web server & mods: Apache 1.3.27
mod_ssl 2.8.11
compiled with the following config options in my Makefile (used FreeBSD port
and added rewrite enable)
--server-uid=www
--server-gid=www
--with-perl=${PERL}
--with-layout=FreeBSD
--without-confadjust
--enable-module=most
--enable-module=auth_db
--enable-module=mmap_static
--disable-module=auth_dbm
--enable-shared=max
--enable-module=ssl
--enable-module=define
--enable-module=rewrite
I am trying to use mod_rewrite to redirect any request for a login from
phpBB to go to a secure (SSL) URL.
For some reason it is not behaving as advertised in documentation(as I
interpret it), am I doing something wrong?
This is in my global section of http.conf (I am not using any virtual
domains.)
-----snip-------
# Rewrite insecure URL requests for phpBB logins to SSL logins
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule http://%{SERVER_NAME}/phpBB2/login.php\?sid\=(.*)$
https://%{SERVER_NAME}/phpBB2/login.php\?sid\=$1 [R,L]
RewriteRule http://%{SERVER_NAME}/phpBB2/login.php$
https://%{SERVER_NAME}/phpBB2/login.php [R,L]
RewriteLog "/var/log/rewritelog"
RewriteLogLevel 9
-----snip--------
The above Rewrite rules do not work. The first rule has additional
characters, because sometimes there is a sid(session identifier) used to
track the session I can't debug it because the Rewritelog doesn't work
either.
(I get the following when starting apache with the RewriteLog statement):
Syntax error on line 439 of /usr/local/etc/apache/httpd.conf:
RewriteLog not allowed here
I figured that mod_rewrite wasn't loading, but the below rules work with
no problem (I need to comment out the Log stuff and above rules):
-The first one redirects "the everything" to a secure URL.
-The second one redirects any requests to the web root over to the php URL.
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^$ http://%{SERVER_NAME}/phpBB2 [R,L]
So this tells me mod_rewrite works, but I must be doing something
wrong....:(
I've been googling around for this for quite awhile with no success, any
ideas?
Thanks, and Happy Holidays to all.
-Tony
- --
Anthony J. Galella
anthony.galella@intel.com
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org