Why is it that when I write the directive Alias /hello /myfile.php it works fine, but if I write Alias /hello /myfile.php?myvar=test apache gives me 'NOT FOUND'.


According to the docs, the alias target can only be a file or path. Is suspect you don't have a file literally called myfile.php?myvar=test on your filesystem.

You might be able to do this with rewrite rules, but in this case, it sounds much easier to handle the default parameter in your script itself.

  • 1
    Alternatively, the OP could probably RedirectMatch ^/hello$ /myfile.php?myvar=test, but this is not invisible to the end user. – Ulrich Schwarz Nov 22 '12 at 8:12
  • Yes, good point but that seems more "intrusive" as you say than a rewrite (or not modifying the URL at all and handling in the program). Not really sure this is on topic here actually. – Mat Nov 22 '12 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.