Reputation: 2474
When I reach the url http://www.example.com/payments/add/2
, it should automatically redirect to https://www.example.com/payments/add/2
.
Note: I have installed ssl on my server.
if($this->params['action']=='add' && $this->params['controller']=='payments')
{ $this->redirect('https://' . env('SERVER_NAME') . $this->here); }
That code is not working. Please help
Upvotes: 4
Views: 503
Reputation: 14268
Try this
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
#redirect www.mydomain.com to mydomain.com (or any other subdomain)
RewriteCond %{HTTP_HOST} !^mydomain.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]
#force https for certain pages
RewriteCond %{HTTPS} !=on
RewriteRule ^(page1\.php|page2\.php|page3\.php|page4\.php)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
Upvotes: 1