Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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'.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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