Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I run Apache on Mac OS X (XAMPP) for a site that uses .htaccess to have URLs like "domain.com/site/section/etc".

The problem is that the URL scheme is not working. It seems that the .htaccess file is not being recognized by Apache.

However, if I point the virtual host of my Mac's Apache to the site version I have on an NTFS partition (which works ok on Windows) then it also works perfectly on the Mac. The site on the Mac partition is an exact copy of that on the NTFS partition (same .htaccess, the same DB, everything).

The .htaccess file has no paths (no references to directories). The following is the same for both the Mac and the NTFS version of the file:

ls -l .htaccess
-rwxrwxrwx 1 root admin 944 Oct 8 16:02 .htaccess
file .htaccess
.htaccess: ASCII English text, with CRLF line terminators

I don't understand what's going on, but it seems like copying the file from NTFS to the Mac partition, makes it useless?

share|improve this question

4 Answers 4

It wouldn't surprise me if the .htaccess file is gaining some stupid permissions from the NTFS volume that is throwing apache off. Try creating a new blank .htaccess and copy the contents of the file into the new one; and see how you go.

share|improve this answer

It could be a couple of things.

  • Is Apache configured to read the .htaccess file? (yes, so that's not the problem)

  • Try running "dos2unix .htaccess" to convert CRLF line endings that could be confusing Apache. (wrong again; assuming both .htaccesses are identical, no reason for this to affect the server on one partition but not the other)

  • The only other thing I can think of is that the copy botched the new file's ownership or permissions. If Apache doesn't have the privs to read the file, it won't take effect.

share|improve this answer
    
I assume: 1) Yes, otherwise it would not read it from the other partition either? And 2) I wondered about the same thing, but I doubt referencing a file on another partition does the conversion on the fly. So why would that work from NTFS then? It might have been erroneously auto-converted during copying though, which file .htaccess might reveal? –  Arjan Oct 9 '09 at 15:07
    
hmm, yeah, i misread: thought the "works on NTFS" referred only to working with a Windows server, and that the file was copied over to a completely different (Mac) server installation. –  quack quixote Oct 9 '09 at 16:07

In Terminal, what do the following commands give you?

ls -l .htaccess
file .htaccess

And likewise for the NTFS version?

And are you sure there's no paths (references to directories) within that file?

(And, sorry to ask: are you sure you actually copied the file, this being a hidden file on Unix? From Terminal, use something like cp -a old-dir new-dir, using -a to preserve the file dates and permissions, and without any /* to copy hidden files as well.)

What if you ensure there's an error (just some typo suffices) in the .htaccess file on your Mac? Do you get a 500 Internal Server error when going to some page then? (Just to determine if Apache is ignoring the .htaccess altogether when the Virtual Host is configured to look at your Mac's partition, or is only ignoring parts of its contents then...)

And are both sites in the same relative location of Apache's root? (Like .../http_docs/ versus ~/Sites/ for both, and not ~/Sites/some/path on your Mac, which could then have other .htaccess files at some lower level)?

share|improve this answer
    
The commands give the same on both partitions: -rwxrwxrwx 1 root admin 944 Oct 8 16:02 .htaccess (and) .htaccess: ASCII English text, with CRLF line terminators And no, the file hasn't any paths, and yes, I copied it with cp and it has 0777 permission –  Petruza Oct 11 '09 at 16:15
up vote 0 down vote accepted

Sorry! I had the apache configured to now allow .htaccess override. :(

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.