Andrew Andrew - 1 month ago 4x
Apache Configuration Question

.htaccess rewrite condition to redirect links from http to https

I have a lot of different links without any logical rules, that are redirected with .htaccess

Redirect 301

.htaccess looks like this:

<IfModule mod_rewrite.c>

RewriteCond %{HTTP_HOST} ^

Redirect 301 /oldlink1 /newlink1
Redirect 301 /oldlink1 /newlink1
Redirect 301 /oldlink1 /newlink1


Some days ago I've set up https. Unfortunately,
redirects to
- not to https but http.

What i'm doing wrong? How should I set up .htaccess file to redirect to https?


If you're changing protocols or sites, then you HAVE to use an absolute url:

Redirect 301 /oldlink

otherwise it's just a "local" redirect and you stay within the same site/protocol.

And note that Redirect is NOT part of mod_rewrite. That's a core directive in Apache (part of mod_alias) and has nothing to do with mod_rewrite at all: