Reputation: 4455
I want to add https in a specified url
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^magsonwink.winkplatform.com/Shopping/paynow
RewriteRule ^(.*)$ https://magsonwink.winkplatform.com/Shopping/paynow%{REQUEST_URI} [QSA,R=301,L]
but this not worked for me. After googling i can't get a specified answer. if any one know about this please help me
Thanks in advance.
Upvotes: 0
Views: 21
Reputation: 785146
Here is the corrected code:
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{HTTPS}s on(s)|
RewriteCond %{HTTP_HOST} ^magsonwink\.winkplatform\.com$ [NC]
RewriteRule ^Shopping/paynow(?:/.*|)$ http%1://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
Upvotes: 1
Reputation: 143886
The %{HTTP_HOST}
variable is only the hostname, no URL-path info is in it. So you need to remove it and add it to the pattern in your rule:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^magsonwink.winkplatform.com$ [NC]
RewriteRule ^/?Shopping/paynow(.*)$ https://magsonwink.winkplatform.com/Shopping/paynow$1 [QSA,R=301,L]
Upvotes: 0