Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Running Apache on Mac Snow Leopard (ie Web sharing enabled).

Paths are evaluating in ways not expected:
example.com/folder is returning a file (sans exception) instead of a folder.

If I make a call to example.com/events/March and I have a file events.php in my root directory, Apache returns that page, and the rest of the path is ignored.

Furthermore, this call takes precedence over the commands in .htaccess

eg. I need example.com/events/March to redirect to example.com/events.php?month=March
Apache returns example.com/events.php without the requisite argument.

RewriteEngine on
RewriteRule ^events/(.+)/?$ events.php?month=$1

If the events.php doesn't exist (let us say it is called eventsHandler.php), then the above rewriteRule works wonderfully. So I know it is not an issue with the .htaccess

I've tried to make file extensions visible, it has not helped.

So the questions are:

  1. Why does Apache on Mac drop the file extension and treat the file as a folder?
  2. Why doesn't the .htaccess overrule this?
  3. How do I fix this, that it should just work?
share|improve this question

migrated from superuser.com Apr 15 '11 at 15:50

This question came from our site for computer enthusiasts and power users.

1 Answer 1

On MacOS, a slash ("/") is a valid character for use in filenames and is not a path delimiter. Try using a colon for the path delimiter instead.

Also, be sure to test your paths in all the code you depend on because you may occasionally encounter some code that will try to automatically convert paths after detecting the OS. We ran into some issues like this back in the Novell NetWare days (not with NetWare, which supported multiple file system naming conventions on a single volume by adding something called a "namespace" on the server-side, but with third-party tools and libraries that can sometimes introduce confusion).

share|improve this answer

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.