David,
Thanks for your reply.
Per your suggestion I chaned the first vhost configuration in ‘httpd-vhosts.conf’ to read:
<VirtualHost *:80>
# ServerName is is absent to default to the "main" server configuration
# for requests that do not match any particular virtual host
ServerAdmin [email]admin@jwnetsource.com[/email]
DocumentRoot "/usr/local/www/vhosts/default/htdocs/"
ErrorLog "/usr/local/www/vhosts/avsms.com/logs/httpd-error.log"
CustomLog "/usr/local/www/vhosts/avsms.com/logs/httpd-access.log" combined
</VirtualHost>
According to Apache documentation leaving the ServerName out of the first definition will default to the configuration defined in ‘httpd.conf’.
FYI: ‘/usr/local/www/vhosts/default/htdocs/’ contains one file; ‘index.html’ for the “Why are you here page.”
Are you suggestioning a different course of action?
Also, I had previously configured ‘httpd-vhosts.conf’ with the both virtual hosts, but left that information out for the sake of brevity. Ssee sample below:
<VirtualHost *:80>
ServerAdmin [email]admin@jwnetsource.com[/email]
DocumentRoot "/usr/local/www/vhosts/DOMAIN.COM/htdocs/"
ServerName DOMAIN.COM
ServerAlias WWW.DOMAIN.COM
ErrorLog "/usr/local/www/vhosts/DOMAIN.COM/logs/httpd-error.log"
CustomLog "/usr/local/www/vhosts/DOMAIN.COM/logs/httpd-access.log" combined
</VirtualHost>
# By default Apache is configured as restrictive server.
# It will not allow end users (client) to do anything on default
# DocumentRoot.
#
# To fix this issue you need to add following lines to your
# VirtualHost configuration directives
<Directory "/usr/local/www/vhosts/DOMAIN.COM/htdocs/">
Options -Indexes FollowSymLinks
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
Sometimes what I articulate is clear as mud. I also leave the last letter of a lot of my words. Forgive me for that.
What I would like to do is have:
- HTTPS://DOMAIN.COM
- HTTPS://WWW.DOMAIN.COM
That will require TWO secure server certificates - if you’re doing this on a production server.
Oops, your correct, lets exclude HTTPS://WWW.DOMAIN.COM
resolve to the secure pages and
HTTPS://ANYANDALLCRAP.DOMAIN.COM
That would likely NOT resolve at all so that SHOULD be a dead link.
[COLOR=“Red”]Nope. If the user accepts the risk issued by the invalid security certificate warning it resolves to whatever page is in the URL, such as HTTPS://ANYOLECRAP.DOMAIN.COM/anyrequestedpage.html[/COLOR]
The certificate flags HTTPS://ANYCRAP.DOMAIN.COM just fine, but if the web site visitor accepts the warning, the url will resolve to HTTPS://ANYCRAP.DOMAIN.COM,which is the same files as HTTPS://DOMAIN.COM and not the desired result.
See comments on DNS at the end.
So, if I want everything but HTTPS://DOMAIN.COM to go to the “Why are you hear page” I would use the following???:
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !^domain\\.com [NC]
RewriteRule (.*) http://DOMAIN.COM/whyareyouhear.html
Then maybe this to redirect the HTTPS://WWW.DOMAIN.COM to HTTPS://DOMAIN.COM:
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^www\\.domain\\.com [NC]
RewriteRule (.*) https://DOMAIN.COM/
Is (.*) correct?
Which config file would you put the rewites:
- /usr/local/etc/apache22/httpd.conf;
- /usr/local/etc/apache22/extra/httpd-default.conf;
- /usr/local/etc/apache22/extra/httpd-vhosts.conf; or
- /usr/local/etc/apache22/extra/httpd-ssl.conf
And where in the config file would you put it?
Or, have I missed your point and you believe there is a better strategy to accomplish my objective.
Regarding DNS; I am not running named on this server. The server has only one IP and my DNS settings for DOMAIN.COM are:
Host Name Record Type Address
www A 0.0.0.0
@ (none) A 0.0.0.0
* (other) A 0.0.0.0
[COLOR="Red"][I]0.0.0.0 substituted for the real IP[/I][/COLOR]
Everything for DOMAIN.COM resolves to the same IP.
Now, to thinkin’ the stew a bit HTTP://DOMAIN.COM and HTTPS://DOMAIN.COM both resolve to “/usr/local/www/vhosts/DOMAIN.COM/htdocs/”
This is only temporary during development, but I don’t see this as the problem here??? Then again, I don’t see the problem at all, so that mostly invalidates the aforementioned sentence. (:
If you got all the way to the end of this post. Wow, I’m impressed.
More ideas please.