Configuring Leopard’s Apache to work with all Rewrite Rules
Although there are a few blog posts out there detailing how to enable .htaccess on Mac OSX 10.5. I didn’t find anything that could help me with a problem I had with a specific RewriteRule.
This post isn’t specific to Leopard but maybe useful to users of this OS due to the default values that it’s pre-installed Apache’s httpd.conf comes set with.
Say for SEO reasons you wanted to rewrite
product.php?id=17
as
product/toaster/17.html
You could use the following rewrite rule:
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
In other blogs it will tell you that you will need to change AllowOverride None to AllowOverride All in the <Directory “/Library/Webserver/Documents”> of /private/etc/apache2/httpd.conf and perhaps also in any conf files found in /private/etc/apache2/users. (This is not enabled by default on Leopard).
What they won’t neccesarily tell you is that to get rewrite rules like the above working you need to remove MultiViews from your Options list, leaving you with something like this :
<Directory "/Library/Webserver/Documents"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory>
I hope this saves someone the trouble I went through this morning trying to figure it out.
For a quick explanation see the short but sweet Apache Multiviews are evil
MarkB
Previous Posts
- The Hyperaudio Pad – Next Steps and Media Literacy
- Breaking Out – The Making Of
- Breaking Out – Web Audio and Perceptive Media
- Altrepreneurial vs Entrepreneurial and Why I am going to Work with Al Jazeera
- HTML5 Audio APIs – How Low can we Go?
- Hyperaudio at the Mozilla Festival
- The Hyperaudio Pad – a Software Product Proposal
- Introducing the Hyperaudio Pad (working title)
- Accessibility, Community and Simplicity
- Build First, Ask Questions Later
- Further Experimentation with Hyper Audio
- Hyper Audio – A New Way to Interact
- P2P Web Apps – Brace yourselves, everything is about to change
- A few HTML5 questions that need answering
- Drumbeat Demo – HTML5 Audio Text Sync
Tag Cloud
-
Add new tag
AJAX
apache
Audio
band
buffered
Canvas
CDN
chrome
community
custom tags
firefox
gig
HTC
HTML5
Hyper Audio
internet explorer
java
javascript
journalism
jPlayer
jQuery
jscript
LABjs
leopard
media
Mozilla
MVP
opera
opera mini
osx
P2P
Popcorn.js
poster
prototyping
rewrite
safari
Scaling
simplicity
SoundCloud
timers
tomcat
video
Web Apps
web design