mod_rewrite - rule to change http to https
Hi again all,
I've got a directory on my server and I'm trying to make a mod_rewrite rule to say something like; http://myserver/ssl/ must become https://myserver/ssl Any ideas? I'm a bit stumped. Thanks :) |
Quote:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} ssl RewriteRule ^(.*)$ https://myserver/ssl/$1 [R,L] That should be it. --Alden |
Thanks for your reply. Unfortunately that doesn't seem to work for me.
I have the directory stated in /etc/httpd/conf.d/ssl.conf like so; Code:
<Directory "/var/www/html/ssl"> Anyhow, the .htaccess is then in there, but no lucky (apache has been reloaded). |
Can the Rewrite rules be used in the directory statements rather than a .htaccess ?
|
Quote:
Where did you put the .htaccess? It should be in the ssl folder. If I get a chance, I'll test this myself, but it's not looking promising. --Alden |
.htaccess is in the SSL folder. I've got a directory statement in ssl.conf specifying allowoverride all to that .htaccess files are used.
It appears that I can't access it at all now :D hehe |
Quote:
I will not be able to get to debug any time soon, though. Can someone else on this board help, please? --Alden |
Thanks for your efforts to help, greatly appreciated.
I'll have a play around in the meantime before a mod_rewrite expert appears ;) |
I've used this in a virtual host declaration:
Code:
RewriteEngine on |
Thanks. Whereabouts should I be putting my directory specification?
Am I doing this completely wrong by specifying it in ssl.conf, although this seems to work.. Would a virtual host declaration be better? |
I'm speaking largely out of ignorance here, so take this with a grain of salt.
I would think that ssl.conf wouldn't be the best place to put this. If a connection comes in on http, I'm not sure that ssl ever plays a role, so ssl.conf may not ever be used. I used a virtual host declaration largely because I have several virtual hosts, and that was the one I wanted re-directed to https no matter what. I suppose .htaccess could do the same, but it was easier to do it in a virtual host declaration since I had to create one anyway. |
All times are GMT -5. The time now is 03:33 PM. |