I’ve started playing around with .htaccess files and mod_rewrite. Now I normally use /Users/myusername/Sites as my localhost folder, but if I put a .htaccess file in there it gets ignored by apache. However if I change my htppd.conf file to point to the default /Library/Webserver/Documents folder, and shove a .htacces file in there, it works fine.
Obviously I’d like to keep using /Users/myusername/Sites to keep my localhost files in, so does anyone have any ideas what I should be doing?
I realise that with mac os x 10.7, there is a separate config file for every user, so I also have a myusername.conf file in my /apache2/users/ directory, which contains the following:
Options Indexes MultiViews
Allow from all
If I change AllowOverride to All, and restart apache, when I load up localhost, I get a 403 error.
What is your DocumentRoot set to, and what do your VirtualHosts look like (if you have any) ?
Well, I had DoumentRoot set to ‘/Users/myusername/Sites’ and the .htaccess file was overlooked by apache, until i reverted it back to the default setting ‘/Library/Webserver/Documents’, and moved the .htaccess file aswell it all good. But i want to set the Users/myusername/Sites as my DocumentRoot AND play with .htaccess files.
As for VirtualHosts, i’m not sure what your refering to. Is that a setting in the config file?
Thanks for your reply,
Does apache have read access in your folder, Users/myusername/Sites ?
And yes, the virtual hosts should be in httpd.conf, or they sometimes (depending on the install) are in /path/to/apache/config/conf.d/vhosts.conf
The permissions for Users/myusername/Sites is Read & Write for me, Read Only for staff and Read Only for everyone, which I’m guessing is the equivalent to 755.
There is a commented-out line in my httpd.conf file which reads:
Should I activate that command?
No you don’t need that, just leave it off. What are the permissions set to for the folder you are now serving from? Does it help if you give your user folder that permissions?
Well, they’re set to 777 now, but the were set to 555 i think when I first got it to work. (I changed it cos I got bored of typing in my password whenever I moved a file)
I checked by changing the permissions of /Users/myusername/Sites to 777, but the problem persists.