While writing a rewrite rule specifically for only a particular URL to remove a trailing slash from it, an infinite redirect loop is occuring.
The following is the code I am trying to code in .htaccess:
RewriteRule ^abc.php /abc/ [R=301,L,NC,QSA]
RewriteRule ^abc/ abc.php [NC,QSA]
I am trying to make a 301 Redirect on abc.php to abc/ but want to serve abc/ with abc.php’s content only. Want to write a Rule specifically for this url only.
You can break the infinite loop if you check the HTTP request line (see here and also here) sent to the server by the browser with a
RewriteCondand, in addition, you reverse the order of the rules: