I encountered an issue for the first time and have no clue why i am having this.
Below you see three lines of my .htaccess file. While /urun/test-123 using urundetay.php, /urunlerimiz/ have to use urunlerimiz.php. The issue is since ‘urunlerimiz’ include ‘urun’ inside of it, all of those three links are using urundetay.php.
RewriteRule ^urunlerimiz/?(.*)$ urunlerimiz.php [NC]
RewriteRule ^urun/?(.*)$ urundetay.php [NC]
RewriteRule ^urun-kategori/?(.*)$ urundetay.php [NC]
It works correctly when i set those parameters completely different. But i have to use it that way and i want to learn.
What is the solution for this?
I have experienced this problem in one of my project as well and here is how I resolved it:
Trick is to append
(/.*|)after every keyword.e.g. for regex
^urun(/.*|)$this will match/urunOR/urun/OR/urun/foobut will not be matching/urunlerimizand/urun-kategor