301 permanent redirection except secure domain
Moderator: General Moderators
301 permanent redirection except secure domain
My site url is http://mydomain.com but in payment section the url is secured(shared). I want to redirect from http://mydomain.com to http://www.mydomain.com .But the payment pages the urls should be same as it is . How can set the Rewrite rule for .htacess files.. Need Some suggestion ...
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: 301 permanent redirection except secure domain
This will redirect anyone who accesses your site on port 80 to the https site and keep them on the same page they attempted to visit.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Joe Ceresini
Network Engineer
jceresini@hostmysite.com
HostMySite.com
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Joe Ceresini
Network Engineer
jceresini@hostmysite.com
HostMySite.com
Re: 301 permanent redirection except secure domain
you can simply redirect it by checking where request came from
$_SERVER['SERVER_NAME']
to see if it's https:
$_SERVER['HTTPS']
and redirect it with header() function.
$_SERVER['SERVER_NAME']
to see if it's https:
$_SERVER['HTTPS']
and redirect it with header() function.