Lost in redirects

I’m in trouble with my .htaccess file. There are hundreds of “old” links from webpages out there to articles on my blog which are not existing anymore. Unfortunately some of them are not forwared to the 404 page, and I don’t have a glue whats the problem. The problem occurs for all links which are permalinks from a veeeeeeery old WordPress blog I had years ago. All those URL’s all end with “/permalink/thats-the-title-of-the-blogpost.html” and are forwarded to “/.index.php”. I’ll guess thats because of my RewriteRules, so I tried to disable some / all of them, without luck. Even though its not Kirby related, hopefully somebody can help me out? Thanks in advance :slight_smile:

There are all my RewriteRules from my .htaccess:

# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301]

# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) error [R=301]

# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) error [R=301]

# make panel links work 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]

# remove trailing slash, but not for the panel
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/panel/.*$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R=301]

# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

## REDIRECT WWW 
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

You have to add these two lines before your rewrite rules.

At least the first line was already in. Added the second line, but it doesn’t fix the issue. I simply added the following to my .htaccess. It magically works. Don’t know if this is the right / best way to do?!

RewriteRule ^permalink/(.*) error [R=301,L]