Forum Moderators: phranque
our first ssl site that we moved over gaves us alot of trouble. we were able to determine that it was due to the following lines in httpd.conf:
<VirtualHost *:443>
ServerName www.domain.org
Redirect / [domain.org...]
</VirtualHost>
which were causing the following error with mod_ssl:
[15/Mar/2004 15:30:30 22545] [warn] Init: (www.domain.org:443) You c
onfigured HTTP(80) on the standard HTTPS(443) port!
when we comment those lines out of httpd.conf out everything starts up and works fine. we had that redirect in place to catch anyone trying to go to [domain.org...] and redirect them to [domain.org...] because our ssl certificat is only for ssl.domain.org.
I also tried adding:
SSLEngine off
into that vhost section but that didn't help.
Is there a fix or a work around for this?
or do I need to resort to mod_rewrite? If that is the case what would the correct mod_rewrite statement(s) look like for this.
Thanks ahead of time.
Dan
RewriteEngine on
RewriteLog /tmp/blah.txt
RewriteLogLevel 3
RewriteCond %{HTTPS} ^on$
RewriteCond %{HTTPS_HOST}!ssl.domain.org$ [NC]
RewriteRule %{HTTPS_HOST} [domain.org...] [L,NC]
it's also not writing anything to the log file.
RewriteEngine on
RewriteLog "/tmp/blah.txt"
RewriteLogLevel 3
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !ssl.domain.org$ [NC]
RewriteRule %{HTTP_HOST} [domain.org...] [L,NC]
if it's coming in on port 443 and they aren't asking for ssl.domain.org send them to www.domain.org. look ok?
If you want to match dots in regular expressions, you'll want to escape them. It would work the way you have it right now, but obviously the more correct way is better.
Also, the syntax for RewriteRule is:
RewriteRule Pattern Substitution
I'm not sure if the RewriteRule you posted will actually work. I would have just used a pattern that matches all files, then redirect to
www.domain.org.
for whatever reason it's still not logging for me and I'm not sure that it's working at all.
In my main httpd.conf I have:
RewriteEngine On
RewriteLogLevel 3
RewriteLog /var/log/apache/mod_rewrite.log
Include /etc/apache/conf.d
inside the conf.d directory there is a file for each of my vhosts.
I have tried putting the following at the top of the file for this vhost:
RewriteEngine on
RewriteLog "/tmp/blah.txt"
RewriteLogLevel 3
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !ssl\.nevadaart\.org$ [NC]
RewriteRule ^/$ [nevadamuseumofart.org...] [L,NC]
but it's not recognizing that for whatever reason. It's not logging anywhere and it's not doing the reidrect. I created a .htaccess under the ssl section of the vhosts htdocs and put the above rewrite statements, conditions and rewrite in it and it sees that but it gives me the following error:
[Wed Mar 17 09:46:11 2004] [alert] [client 1.2.3.4] /home/jail/www.domain.org/www/ssl/.htaccess: RewriteLog not allowed here
for each of RewriteLog, RewriteCond and RewriteRule.
I did make sure to add :
AllowOverride AuthConfig
to the directory.
Am I missing a step?
If you're going to match all files, you should replace this:
^/$ with this:
.* Besides, if you're putting your code in .htaccess, the path you match the pattern against doesn't usually begin with a slash.
Since there aren't actually any letters in the pattern, the
flag is useless so you should remove it. NC
Also, because you're doing an external redirect, you should use the
flag. R
Addressing issues in post sent at 5:56 pm:
If you check the mod_rewrite documentation, you'll find that the use RewriteLog is not permitted in .htaccess.
When I hit [domain.org...] I do get redirected to [domain.org...] but I get prompted or warned from my browser that the ssl cert is for ssl.domain.org but i'm going to www.domain.org. Is there any way to avoid this. I'm guessing there isn't because the ssl negotiation is happening first before the redirect happens correct?