سؤال

I am trying to write a mod_rewrite rule for my apache server. My requirement is that I have three web applications on a server, out of which all request to HTTP scheme should be redirected to HTTPS.

Here's what I have written :

RewriteEngine On

RewriteCond $1 ^abc$ [NC]
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

This doesn't seems to be working fine. I am trying to run application with abc context root to run on HTTP and all other requests to be redirected to HTTPS URL.

Can anyone tell me what am I doing wrong.

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top