httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Thyssen" <>
Subject Re: [users@httpd] Mod Rewrite assistance sought (hoped for :-)
Date Tue, 17 Jul 2007 15:21:03 GMT
On 7/17/07, Robert Granvin <> wrote:
> Standard web site is at "" while
> the secure URL is at ""

So you can't use the same document root for both hosts?
If you need different content, except for some folders,
simply use the Alias directive in httpd.conf.

Alias /images "/var/www/foo/images"

or something.

> (Basically, make sure that local references such as "/images/blah.gif"
> become "/foo/images/blah.gif" and hard URLs embed the site reference into
> it... The user will connect to "",
> but I need to extract the "foo" to use in the other URLs.)

I'd use a symbolic link for that. So, on the server, if it's linux/unix:

# ln -s /foo/images /images

or whatever you need for that. To use Rewrite for that is overkill.

If you would like httpS to 'appear' only for,
do something like this in httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /var/www/site.com_doc-root
ServerAlias *
# this ^^ catches mistyped hostnames, like ""
# and "", and limits traffic
# by having all calls go to one hostname..

RewriteEngine on
RewriteCond %{HTTP_HOST}  ^secure\.site\.com
RewriteRule ^/(.*)$$1 [R,L]
RewriteCond $1          =secure
RewriteRule ^/(.*)$ [R,L]
# this all forces the "" requests to go over SSL.
RewriteCond %{HTTP_HOST}  !^$
RewriteRule ^/(.*)$1 [L,R]
RewriteOptions inherit


and then this - for example - in ssl.conf:

<VirtualHost _default_:443>
DocumentRoot /var/www/

ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
SSLCertificateChainFile /etc/httpd/conf/ssl.crt/ca.crt
SSLCACertificatePath /etc/httpd/conf/ssl.crt
<Files ~ "\.(cgi|shtml|phtml|pl|php3?)$">
SSLOptions +StdEnvVars
<Directory "/var/www/">
SSLOptions +StdEnvVars
SetEnvIf User-Agent ".*MSIE.*" \
 nokeepalive ssl-unclean-shutdown \
 downgrade-1.0 force-response-1.0
 CustomLog logs/ssl_request_log \
  "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

# Julius B. Thyssen

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message