M
M
Mikhail Osin2015-11-12 13:14:15
SSH
Mikhail Osin, 2015-11-12 13:14:15

How to properly set up a rewrite on Apache!?

The case is next.
There is an iron CISCO balancer on which a sample is configured for a server on port 80. (443 is not suitable)
There is Apache 2.4 on which rewrites are configured in the virtual host for port 80:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(healthd)/(.*)$
RewriteRule ^/(.*)$ https://www .mysite.ru/$1 [L]
The sample file itself is located in %{DOCUMENT_ROOT}/healthd/mysite.inc
Logically, all links should be redirected to port 443, excluding /healthd/mysite.inc
But in the rewrite logs I see that the link www.mysite.ru/healthd/mysite.inc still redirects to https://
How to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osin, 2015-11-12
@Telsir

For port 80, the following was done:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/healthd/mysite.inc$
RewriteRule ^/(.*)$ https://mysite.ru/$1 [L]
RewriteRule ^(/healthd/mysite .inc)$ www.mysite.ru/healtchd/mysite.inc [R=200]

V
Vitaliy Orlov, 2015-11-12
@orlov0562

Try temporarily redirecting REQUEST_URI to a script and see what exactly comes there:
.htaccess

RewriteEngine On
RewriteRule ^ index.php?rq=%{REQUEST_URI}

index.php
<?php
  print_r($_REQUEST);

I don't think RewriteCond is working.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question