Forum Moderators: phranque

Message Too Old, No Replies

SSL "test" and redirect?

         

MrPiercer

4:13 pm on Mar 20, 2004 (gmt 0)

10+ Year Member



First of all, I won't even try to appear as knowledgeable.. :) I don't know squat about regexps and mod_rewrite...

But I do know what I need to accomplish. I run Apache 2.0.47, and ideally my setup would:

*run mass virtual hosting with mod_vhost_alias for hosts on port 80. (Now that's easy..)

On SSL port 443, there should be a web site to view for the exact domain URL only. F.x. [server.tld....] (Where www.server.tld is the machine's native name.)

Every https request *NOT* to that domain name should be presented by an error page.

Lets say I have a virtual host named www.virtual.tld, it should be accessible only via port 80, i.e. [virtual.tld....]

If a user should point his browser to the SSL port with the URL [virtual.tld,...] then that user should be presented with an error page saying something about "nothing here" and so on.

I guess that this can only be accomplished with mod_rewrite, but I have no idea on how to write the rules needed. I'm absolutely new to this kind of setup, and the few pages I've found about mod_rewrite only makes me more confused about it, not the other way around.

Anders

jdMorgan

2:01 am on Mar 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anders,

Welcome to WebmasterWorld [webmasterworld.com]!

The following links will help to get you started off in the right direction:

Apache forum charter [webmasterworld.com]
Introduction to mod_rewrite [webmasterworld.com]
Apache mod_rewrite [httpd.apache.org]
Apache URL rewriting guide [httpd.apache.org]
Regular Expressions primer [etext.lib.virginia.edu]
SSL-rewrite-related thread [webmasterworld.com]

Jim

MrPiercer

1:25 pm on Mar 21, 2004 (gmt 0)

10+ Year Member



Thanx!

I got something to work, but I'm a little confused, it seems just like "too easy".. :)

RewriteEngine On
RewriteCond %{HTTP_HOST}!the-server\.net [NC]
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/ /srv/www/htdocs/nothere.html [L]

Could it really be that easy?

Anders.

jdMorgan

2:55 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anders,

That looks fine to me. Test all of the variations of your scenario, and if it works, it works. :)

Jim

MrPiercer

3:01 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



I'll vote for that.. ;)

I've tried just about anything I think, and it seems to work just as intended..

Later!
Anders.