301 Redirects Via 000-default.conf File and WordPress Redirection Plugin Issue

In the file 000-default.conf (folder site enabled) I have those lines:

# Added to mitigate CVE-2017-8295 vulnerability
UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} [OR]
RewriteCond %{SERVER_NAME}
RewriteRule ^ https://www.%1%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

For example, my website works on this address and in the WordPress general settings I have the same address as the main website address:

Checking all redirection scenario, I saw that left small issue - from this URL don`t work the redirect here:

I use this code:

RewriteEngine on RewriteCond %{SERVERNAME} [OR] RewriteCond %{SERVERNAME} RewriteRule ^ https://www.%1%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

So I checked all redirect scenario: - redirect here - redirect here - dont redirect here - is ok So as you see this URL: dont redirect here:

Also actually I don`t know related it to this code or not, but also I use the special redirection plugin called “Redirection” for WordPress - I set-upped 301 redirects from the / - main page to absolutely another website.

And interesting thing - when I delete this redirect via redirection plugin all seems that works well and all redirection scenario works well, but when I use the redirection plugin only this one scenario: - don`t redirect here - it directly begins to redirect to the another my website.

So when i using the redirection plugin from the / main page to another website all those redirects scenario works well except only one: - redirect here and them to the another website - redirect here and them to the another website - don`t redirect here but directly redirect to another website

Tell please why it is happening and how to fix this issue?

Many thanks.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


You need to make sure that you have a VirtualHost for port 443 for your domain name.

The easiest way to do that is to install a Let’s Encrypt SSL certificate with CertBot which would automatically create the Vhost for you.

Hope that this helps! Bobby