Enabling Url Rewriting on Apache
Just a quick note to myself (not that I've just wasted half an hour setting up a collegues machine), that if you want to rewrite urls using an .htaccess file then you need to add it to your VirtualHost config and enable the rewrite module in the http.conf file.
To get Apache to load the rewrite module, find the http.conf file, if you are using XAMPP the file path is C:\xampp\apache\conf\http.conf.
Open it up in a text editor and search for the line:
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the comment so that you have:
LoadModule rewrite_module modules/mod_rewrite.so
Save the file.
Now you need to update your VirtualHost configuration to use the .htaccess file. Open the http-vhosts.conf file (if you are using XAMPP the file path is C:\xampp\apache\conf\extra\http-vhosts.conf) and add:
AccessFileName .htaccess
So you will now have something like this:
<VirtualHost *:80>
ServerName localhost.aliaspooryorik.com
DocumentRoot "C:\xampp\htdocs\aliaspooryorik"
DirectoryIndex index.cfm
AccessFileName .htaccess
ErrorLog logs/localhost.aliaspooryorik.com-error_log
CustomLog logs/localhost.aliaspooryorik.com-access_log common
</VirtualHost>
Restart Apache and everything should work just fine :)
- Posted in:
- Apache


Now to work out what to put into .htaccess :|
Cheers,
crispin
Comment by Crispin – January 19, 2011
Comment by Ruchi – February 24, 2012