I have this problem for quite a while now and already read lots about it, but I still keep getting in trouble with my redirects or potential duplicate Content, being triggered by my settings in the .htaccess together with my canonical tag in order to clean up with trailing slashes and different variants of my page.
Currently different tools show that my pages, e.g. /potatoe
is also found under /potatoe/
. Moreover I have other pages that trouble with double-redirects, because I seemingly redirect with a permanent 301
, which does not take into account the canonical tag on the page. So, e.g. /potatoe/
(with "/") is set as a canonical tag and the source code shows (without even regarding the canonical tag):
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://example.com/potatoe/">here</a>.</p>
<hr>
<address>Apache Server at example.com Port 443</address>
</body></html>
My .htaccess
is as follows:
ErrorDocument 404 /error404.php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
AddDefaultCharset utf-8
order allow,deny
allow from all
deny from 123.249.24.233
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\/index\.php\ HTTP/
RewriteRule ^index\.php$ https://example.com/ [R=301,L]
RewriteRule ^Index\.php$ /index.php [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ https://example.com/ [R=301,L]
RewriteRule ^index\$ https://example.com/ [R=301,L]
I am thankful for any help/tips!