Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Allowing .htaccess on your OSX web server

I followed these steps here: Setting up a local web server on a Mac, and it was great. Except I struggled for hours with one small issue and I thought it was useful to note. Except there's no way to comment on that article?


The issue is that if you want to allow .htaccess files (common for Wordpress and many other pieces of software) you have to make two small changes to the instructions (listed here for Yosemite).


<Directory "/Users/<your short user name>/Sites/">

AddLanguage en .en

LanguagePriority en fr de

ForceLanguagePriority Fallback

Options Indexes MultiViews FollowSymLinks

AllowOverride All

Order allow,deny

Allow from localhost

Require all granted

</Directory>


The two changes are to add the Option FollowSymLinks and change AllowOverride to All.


Hope this helps someone and saves them the hours it cost me.

Posted on May 7, 2015 11:29 AM

Reply
2 replies

Sep 28, 2015 7:10 PM in response to clwill00

Following this guide as well as the suggestion above, I managed to get .htaccess rewrite working with difficulty and not ideally. I am posting the additional steps I've taken as well as posing my question here incase clwill00 can answer for everyone.


Although, the "Sites" directory I created in my home directory works fine with both html or php pages, when I created an .htaccess file in that directory it did not appear to work. When I troubleshooted the problem (partially using this guide), I found the file was being read. On a forum I read that some servers require the "RewriteBase /" command, which I added. Eventually I figured out that on yosemite 10.10, despite having the the .htaccess file in the "Sites" directory as setup up in the apache config files (see first guide) was redirecting to the default /Library/WebServer/Documents directory with the "RewriteBase /" command (and not working at all without it).


Currently, by putting the the files I want to rewrite to in the /Library/WebServer/Documents directory and the .htaccess file in the "Sites" directory I created and referenced in the apache config files as per the first guide, I have gotten rewrites working to a test PHP file, using the following .htaccess file:


RewriteEngine on

RewriteBase /

RewriteRule ^.*$ test.php


This is fine for me, since I am only using the server for basic testing purposes, but still I would really like to understand the issue and be able to fix it, and others who are using their MAMP server for small scale hosting, etc, may need this info too.


Any help would be appreciated.

Allowing .htaccess on your OSX web server

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.