- Enter Apache 2.2 conf directory:
> cd C:\Program Files\Apache Software Foundation\Apache2.2\conf
- Open httpd.conf
> notepad httpd.conf
- Uncomment loading of read-write module by removing #:
LoadModule rewrite_module modules/mod_rewrite.so
- Uncomment including virtual hosts delaration file by removing #:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf - For declaring only localhost
- create or clear contents of file conf/extra/httpd-vhosts.conf
- Copy and paste the following in this file:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory><Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from allRewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory># Use name-based virtual hosting.
NameVirtualHost 127.0.0.1<VirtualHost 127.0.0.1>
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
ServerName localhost
DirectoryIndex index.php
</VirtualHost>
Jeff in Seattle
Very helpful guide
Very helpful post.
I would also like to add that you also may have to set the “AllowOverride” directive to “All” [around line 224 in the httpd.conf file] to allow directives in the .htaccess to work.
around that line, you can see,
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
—
Cheers,
shaunak.
Thanks
@shaunak
Thanks so much. I’ve tried everything under the sun, and it didn’t work. Your post led me to this in my httpd.conf:
Options FollowSymLinks
AllowOverride None
Which was overridding every single thing I tried, and I didn’t even know it. As soon as I changed None to All, boom, it was working.