bingshui.org

the Life of Zim

30th March
2011
written by dzimney

So there are a ton of possible reasons why your .htaccess files might not be working. If the AllowOverride is set to None in a parent directory, that could be causing problems. If AccessFileName is not set correctly in your apache2.conf, that could be the source of your misery. In my case, it was the rewrite module. It appeared as though my .htaccess files weren’t being read by the server because rewrites is basically all then do on my sandbox. So, what’d I do? Spent the past six hours fighting with all the things that were working only to find that there’s a rewrite module that has to be enabled. Who knew.

So, enabling the module is pretty simple, assuming you’ve got it installed. Pretty sure it’s a default module though, it should be at least, but then again it should also be enabled by default in my opinion. Anway, you just need to make a symbolic link to the rewrite.load file from the mods-available directory to the mods-enabled directory (all found in your apache2 directory, usually found at /etc/apache2).

QUICK ANSWER:
Open a terminal and run the following:

$ cd /etc/apache2/mods-enabled
$ ln -s /etc/apache2/mods-available/rewrite.load rewrite.load

NOTES:
There are couple of things to note here. First, we are assuming that Apache is installed at /etc/apache2 on your system. We are also assuming that you have the rewrite module file rewrite.load in your /etc/apach2/mods-available directory. Finally it is important to note that when running the second line in the terminal, the one creating the symbolic link, you have to enter the full path to the file in the first parameter. You can’t shorthand it or enter it as a relative path.

Also, you can do a quick check of your mods-enabled directory. If there’s a link to the rewrite.load file already in there, this solution obviously isn’t going to work for you, so good luck.

Hope this saves someone else six hours of their life.

23rd November
2009
written by dzimney

Today I was messing around with the built in Apache server on my Mac. What I was doing seemed simple enough; start my apache server with Web Sharing turned off in my system preferences. So I turned off Web Sharing and went for my Terminal, entering:

apachectl graceful

Expecting Apache to restart/start I was surprised to get this error:

launchctl: CFURLWriteDataAndPropertiesToResource( /System/Library/LaunchDaemons/org.apache.httpd.plist) failed: -10

After searching around online for a bit I realized that my problem was I failed to enter the command as root (or I forgot to put sudo in front of my command.
With a second attempt I entered:

sudo apachectl graceful

And vuala, apache is on. No errors. However, now when I enter:

sudo apachectl status

I get this error:

/usr/sbin/apachectl: line 106: lynx: command not found

Not sure what that’s about. If anyone’s got any ideas, I’d appreciate it.