Mike Soultanian wrote:
Our campus has an SSL certificate for www.csulb.edu. If you go to https://www.csulb.edu everything works peachy.Now, if you go to https://csulb.edu, you get an error. I talked to our server admin and he said it's because our certificate is registered to www.csulb.edu and not csulb.edu. He said only a wildcard certificate would fix this problem, but that something that the campus doesn't want to do for security and cost reasons.So, is it possible to set up a rewrite condition such that when someone tries to navigate to https://csulb.edu, it will automatically redirect the user to https://www.csulb.edu and avoid the certificate error? I tried using the following in a .htaccess file and it didn't work (still got the error):RewriteEngine on RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} !www RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [R]I thought maybe if the above code was put somewhere in the httpd.conf file it might work?It seems like a long-shot (admin didn't think it'd work), but I figured I'd ask the experts here. Any other possible ways to work around this?Thanks! Mike
You can simplify this a bit by saying "redirect anything that is not going to www.csulb.edu". However, you'll have to put the rewrite directives inside the <VirtualHost> configuration for the SSL version of the site, as the .htaccess file is run after a connection is established with the browser.
RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.csulb\.edu$ RewriteRule ^/(.*)$ https://www.csulb.edu/$1 [R=permanent,L] -- Justin Pasher --------------------------------------------------------------------- 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@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx