• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Redirection Issues Website

Sally1

Regular Pleskian
Hello,


I checked my website https://lemontrend.com under http://www.redirect-checker.org , and found out that I have 19 Redirects, and that the Versions http://, http://www., https://www. Not Point to https://lemontrend.com





Result: http://lemontrend.com



Too many redirects. Please try to reduce your number of redirects for http://lemontrend.com. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.



Result: https://lemontrend.com



Too many redirects. Please try to reduce your number of redirects for https://lemontrend.com. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.



Result: http://www.lemontrend.com



Too many redirects. Please try to reduce your number of redirects for http://www.lemontrend.com. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.



Result: https://www.lemontrend.com



Too many redirects. Please try to reduce your number of redirects for https://www.lemontrend.com. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.





I use OS ‪CentOS 6.10 (Final) Plesk Onyx (Apache and Nginx Running) and Cloudflare Flexible SSL Account Free)

Version 17.8.11 Update #37 with the following Settings in Plesk Panel:



Websites & Domains -> Preferred domain * - lemontrend.com

SSL/TLS Support marked

Permanent SEO-safe 301 redirect from HTTP to HTTPS – Not marked while when I mark this the website is afterwards not reachable



Apache & nginx Settings - Additional Apache directives - Additional directives for HTTP

RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'

RewriteRule ^(.*)$ https://lemontrend.com$1 [L,R=301]



On my Wordpress Website I have the following Plugins:



Really Simple SSL with the Setup:

success SSL is enabled on your site.

success Mixed content fixer was successfully detected on the front-end

success An SSL certificate was detected on your site.

success 301 redirect to https set: WordPress redirect

success Secure cookies set



Cloud Flare Flexible SSL Plugin installed



I checked all the Settings but I don’t know why there so many redirections, and how I can redirect all Url Versions to https

Have someone a similar Setup with Plesk, Apache, Nginx and Cloud Flare?



Thanks

Best regards

Sally
 
Hello,

I found the issue under Apache & Nginx Settings where the Point Enable nginx caching marked, and with this Config, the redirection errors occur.



3.png


Please see here the other Apache Config what I have:


1.png

2.png


What do I have to adapt to be able to use the nginx caching feature without getting 19 redirections? What other directives I can add for apache and nginx to speedup my website?

Thanks a Lot!

best regards
Sally
 
If you would decide to use only Nginx without Apache I can post my whole configuration, which most nginx-only-users use.
Until two years ago I also used the "normal" nginx as proxy server setup, but I always put the apache configuration in the .htaccess file, not in "additional directives for http". Gzip for nginx I always (no matter which kind of configuration setup) I put in the global nginx.conf in /etc/nginx/.(ubuntu).
 
Thanks for your reply. Do you have some example snippets for htaccess what I can use, and how I can use additional the enable nginx caching option?

Thx
 
Yes, here is my old configuration. It worked perfectly for WoltLab community software which is very similar to Wordpress. But I know you have to leave out the Woltlab section and have to use Wordpress specific configuration parts.
1. Box is the .htaccess configuration only for WoltLab Community Software
2. Box is the .htaccess configuration for SEO of WoltLab Software
3. Box is the .htaccess configuration especially for WORDPRESS installations

Code:
Options +FollowSymlinks

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

# Rewrite application /calendar/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^calendar/(.*)$ calendar/index.php?$1 [L,QSA]

# Rewrite application /blogs/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^blogs/(.*)$ blogs/index.php?$1 [L,QSA]

# Rewrite application /photos/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^photos/(.*)$ photos/index.php?$1 [L,QSA]

# Rewrite application /forum/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^forum/(.*)$ forum/index.php?$1 [L,QSA]

# Rewrite application /
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</IfModule>

# caching
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|svg|swf)$">
    ExpiresActive on
    ExpiresDefault "access plus 10 days"
    Header unset ETag
    FileETag None
</FilesMatch>

# compression
<IfModule mod_deflate.c>
    <FilesMatch "\.(html|htm|css|js|xml|php|txt|svg)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
</IfModule>

<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
    RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
    <FilesMatch "(\.js\.gz|\.css\.gz)$">
    # Serve correct encoding type.
    Header append Content-Encoding gzip
    # Force proxies to cache gzipped & non-gzipped css/js files separately.
    Header append Vary Accept-Encoding
    </FilesMatch>
</IfModule>

Better to leave the following Woltlab part out:
Code:
# Rewrite application /calendar/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^calendar/(.*)$ calendar/index.php?$1 [L,QSA]

# Rewrite application /blogs/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^blogs/(.*)$ blogs/index.php?$1 [L,QSA]

# Rewrite application /photos/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^photos/(.*)$ photos/index.php?$1 [L,QSA]

# Rewrite application /forum/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^forum/(.*)$ forum/index.php?$1 [L,QSA]

# Rewrite application /
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</IfModule>

So, you will have the following which is an overall Apache specification:
Code:
Options +FollowSymlinks

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

# caching
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|svg|swf)$">
    ExpiresActive on
    ExpiresDefault "access plus 10 days"
    Header unset ETag
    FileETag None
</FilesMatch>

# compression
<IfModule mod_deflate.c>
    <FilesMatch "\.(html|htm|css|js|xml|php|txt|svg)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
</IfModule>

<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
    RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
    <FilesMatch "(\.js\.gz|\.css\.gz)$">
    # Serve correct encoding type.
    Header append Content-Encoding gzip
    # Force proxies to cache gzipped & non-gzipped css/js files separately.
    Header append Vary Accept-Encoding
    </FilesMatch>
</IfModule>
 
Last edited:
Back
Top