I have a rewrite rule that works perfectly across domains but creates an endless loop on the same domain.
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ url.php?i=$1 [R=301,L]
the goal is to create an alternative to the 404 error that goes correctly to a page in a link shortening application.
for example, example.com/abc needs to redirect to example.com/url.php?i=abc
i.e. it fetches the 'abc' from after the '/'
however as long as url.php is hosted on xyz.com it redirects once and ends up with
example.com/url.php?i=url.php instead of the value "abc"
What is the best way to fix this rewrite rule so it fetches 'abc' once and passes it to the correct url.php?
thank you
RewriteCond %{REQUEST_FILENAME} !-fbefore yourRewriteRuleto skip all files to rewriteRewriteCond %{REQUEST_FILENAME} !-fliterally as is beforeRewriteRuleline