Unlikely Teacher

1. Share Everything* [Programming Gotchas, Technology News, Insights on Living and Everything in Between]

Apache 2.2 and mod_rewrite

July 10th, 2008 · 4 Comments · PHP

This is a super short (and very rough) post on how to enable mod_rewrite in Apache 2.2.

I have seen numerous posts on how to create “rewrite” scripts but found very little information on how to enable this feature in Apache 2.2.

Step 1: Uncomment the line with “mod_rewrite.so” from httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

Step 2: Search for the keyword “.htaccess” and change the AllowOverride value

AllowOverride All

Step 3: Restart Apache and check if module has been loaded (LoadedModule section in phpinfo())

Step 4: Create a test .htaccess in your root directory

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^success\.html$ index.php [L]

Step 5: Type http://localhost/success.html in your browser (change port info based on your setup)

You should be able to see your index.php load up.

Recommended book:

1590595610

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • StumbleUpon
  • Tumblr
  • Twitter

Tags: ·

4 Comments so far ↓

Leave a Comment