CodeIgniter Forums
.htaccess.. little help please - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: .htaccess.. little help please (/showthread.php?tid=4594)



.htaccess.. little help please - El Forum - 12-05-2007

[eluser]citryer[/eluser]
Dear All,

what rules should I put-in, into my .htaccess file to redirect any one visiting http://mywebsite.com/index.php/admin/login to its SSL equivalent i.e https://mywebsite.com/index.php/admin/login

Thanks and looking forward to your replies.


.htaccess.. little help please - El Forum - 12-05-2007

[eluser]garaget[/eluser]
I would try this at the top of your admin/login view file
Code:
if ($_SERVER['HTTPS']!= 'on') {
// Redirect user to secure page
header("Location: https://mywebsite.com/index.php/admin/login");
exit;
}

If this is not best way to do it, then please take other suggestions. Use at your own risk Wink


.htaccess.. little help please - El Forum - 12-05-2007

[eluser]citryer[/eluser]
I would prefer if this can be handled at .htaccess end. Smile
but thanks anyways..


.htaccess.. little help please - El Forum - 12-05-2007

[eluser]garaget[/eluser]
Code:
RewriteEngine On
RewriteRule "^/index.php/admin/login" "https://%{HTTP_HOST}/admin/login" [R=301,L]

my htaccess skills is even worse.. same warning


.htaccess.. little help please - El Forum - 12-05-2007

[eluser]citryer[/eluser]
didn't work... no redirection took place.
Just one URL to be taken care of while all the other areas of the website will be NON-SSL based. Sad