Apache

RSS
Posts: 2

Zend Server and XAMPP .htaccess mod_rewrite is on but ignored, creates 404′s

Virtual hosts require the rewrite engine be set in the conf rather than the .htaccess file. If you’re using a virtual host, put the mod rewrite commands in the virutal host settings.

Include the vhosts conf file by uncommenting c:\program files\zend\apache2\conf\httpd.conf:

Include conf/extra/httpd-vhosts.conf

Add a virtual host to conf/extra/httpd-vhosts.conf. Note that a conf RewriteCond requires a pre-pended slash where .htaccess doesn’t, so you are rewriting /index.php, not index.php.

NameVirtualHost *:80
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
DocumentRoot "c:\Program Files\Zend\Apache2\htdocs\yourapp"
ServerName yourapp.local
SetEnv APPLICATION_ENV development
<Directory "c:\program files\zend\apache2\htdocs\yourapp">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Add virtual host server to c:/windows/system32/drivers/etc/hosts:

127.0.0.1 yourapp.local

Restart apache

2013 © Web Programming Answers