0

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.

2 Answers 2

1

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]  
  • Above code will work both with HTTP and HTTPS
  • No need to use QSA flag since you aren't modifying query string
Sign up to request clarification or add additional context in comments.

Comments

0

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]  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.