Allow htaccess and Mod Rewrite in Wamp

by Hiroshi on October 5, 2009

in htaccess, Mod Rewrite

You must enable mod_rewrite before you can use it. If you want to enable it in httpd.conf, then use

Options FollowSymLinks Fileinfo
or
Options SymLinksIfOwnerMatch Fileinfo

If you wish to enable mod_rewrite at the .htaccess level (i.e. only in certain (sub)directories within each vHost and not for all (sub)directories of each vHost), then you must set allowOverride Options (at a minimum) in httpd.conf, and place one of

Options +FollowSymLinks
or
Options +SymLinksIfOwnerMatch

in the .htaccess file(s) to enable mod_rewrite.

In the latter case, it is usual to set Options Fileinfo (and any others) in httpd.conf, and then set Options +FollowSymLinks in .htaccess along with +/-indexes, +/-MultiViews, etc. as desired. Take a look at the +/- add/subtract option syntax versus fixed Option declarations — You’ll likely want to establish fixed baseline Options in httpd.conf, and then use the add/subtract syntax at the .htaccess level. For security, don’t enable any Option unless you’re sure you need it.

If you did not get any clue what the crap was just above, just ignore it and do the following.

Go to Wamp -> Left click at icon in the taskbar -> Click Config files -> httpd.conf
A file will be opened.
Search rewrite in it.
You will get:

#LoadModule rewrite_module modules/mod_rewrite.so

Remove hash from the beginning (Uncomment it) e.g.

LoadModule rewrite_module modules/mod_rewrite.so

Save the file. Mod Rewriting is enabled.

Open Notepad or Textpad or Dtreamweaver.
Create new file.
Save it as .htaccess in the required directory or root directory of website.
Copy and paste the following in it.

Options +FollowSymLinks
RewriteEngine On

And you are done. Use this .htacces file now to code onward and it will work.
The above, when you uncommented the rewrite thing, you enabled mod-rewrite in wamp.

This case is important when there is involvement of redirecting and the use of .htaccess file at localhost. e.g. When you use WordPress at localhost for development purpose, then this method to allow .htaccess file and mod-rewrite for wamp is good. Its GoOoOOoOooD!

Related Posts

Previous post:

Next post: