Strange Redirects

Knowledgebase > FAQ > Strange Redirects

If you have strange URLs in your analytics or you can see that the site redirects to an URL like this:
https://www.yoursite.com/wp-content/cache/yoursite.com/desktop/unauthenticated/index.html

This is probably caused by an improper order of htaccess rules. Probably you are using a force SSL or force www/non-www rule in .htaccess. Please remove these rules from .htaccess, and insert them in

Settings » General » Tweaks » Custom Htaccess

Some examples

# Redirect non-www to (ssl) www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
# Redirect non-SSL to SSL
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# Redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Did you like this article?