It seems that no matter what I search I just can't understand why I keep getting this issue and I for some reason can't find a good explanation on how it works. Also sorry if this quest was asked before but I have been searching for an answer for 2 days and just can't find the answer. (probably searching the wrong keywords)
BUT.
I am currently having an issue regarding my redirects that use the Redirect
and RewriteRule
functions.
The context is as follows.
The company I work for has recently migrated and updated its website from server and design. This of course means there are pages that are not available anymore or URLs that need to be redirected.
The issue first came up when I was walking through all the redirects and noticed that some redirects didn't go to the page they should.
Below is a piece of the the .htaccess
file that is giving me the issues.
The lines are in the same order as they are in my .htaccess
.
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /nieuws/168/Luchtvaartmaatschappij-delft-onderspit-bij-Hoge-Raad [https domainname]/nieuws
Redirect 301 /nieuws/145/Artikel-Telegraaf-Vertraging [https domainname]/nieuws
Redirect 301 /nieuws/145/Artikel-Telegraaf:-Vertraging.html [https domainname]/nieuws
Redirect 301 /nieuws/108/Wie-gaat-nu-via-(reis)verzekeraars-werken-`Reisagenten-kunnen-klanten-ook-verwijzen` [https domainname]/blog/euclaim-gaat-nu-via-reis-verzekeraars-werken
Redirect 301 /nieuws/136/Technisch-mankement-geen-overmacht.html [https domainname]/blog/technisch-mankement-geen-overmacht
RewriteRule ^nieuws/([1-9]|[1-9][0-9]|[1-9][0-9][0-9]||[1-9][0-9][0-9][0-9])/.*$ /nieuws [R=301,NC,L]
The problem is when I go to /nieuws/136/Technisch-mankement-geen-overmacht.html
I get redirected to /nieuws
.
The issue
Now the issue isn't that I don't know what part of the htaccess is causing this but more why and how can I solve this.
The RewriteRule
is picking up the URL and redirecting to /nieuws
and it doesn't matter where I place it as it just keeps picking it up without fail.
I tried putting the RewriteRule
at the top, bottom, right behind the redirects like in my example but nothing seems to stop the RewriteRule
from taking the top priority.
Is this normal behaviour or am I doing something wrong here?
If you need any more info please let me know.