It's likely that the URL is being rewritten more than once.
The first time rewrites /Hello
to testing.php
but then internally a separate request is made to testing.php
and ran through the rewrite engine again. That will give you testing.php
as the URL parameter.
Using QSA
means that on the second request it is appending to the query string as opposed to overwriting it. If you looked at $_SERVER['QUERY_STRING']
you would likely see something like url=testing.php&url=Hello
(or similar) and php is just using the last value in url
.
Using NC
is not necessary as the pattern you are using has no case (.+
matches one or more of any character regardless of case).
Using L
means to stop processing rules in this request, but doesn't stop processing rules in subsequent requests (including transparent/internal subsequent requests).
Usually this is fixed by telling mod_rewrite to ignore the request if it is made to a file that exists using a RewriteCond
like:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ testing.php?url=$1
Which tells apache that if the requested filename is not a file and not a directory, process the rule. With this in place, the request to testing.php
will see the file exists, condition fails and so the rule isn't processed additional times. Nothing would stop additional rules from applying though if they exist. And also, just an FYI, conds only apply to the very next rule. So if you multiple rules, you need these cond for each of them.