Htaccess SSL redirect

.htaccess

Currently the coder has the following line in the .htaccess file:

RewriteRule ^registration$ registration.php

I understand what this means.

However I also want to redirect domain.com/registration to
https://domain.com/registration

Anybody know how I could achieve this? I do not want any other pages in the app to go to https://…

Regards,
Fiona

Best Answer

You need to ensure that the traffic is not already coming in via HTTPS before your perform the rewrite otherwise you could end up with an infinite rewrite loop.

Assuming Apache 2.0 and above:

RewriteCond HTTPS off
RewriteRule ^/registration$ https://domain.com/registration.php
Related Topic