Forum Moderators: phranque
This works well, except that I get a server 500 error if I try to add "RewriteEngine On" to my .htaccess file located in public root. I suspect that this might be due to something incorrect with my hosts and httpd-vhosts.conf files.
Windows/system32/drivers/etc/hosts:
127.0.0.1 localhost
127.0.0.1 mysite.local
apache/conf/extra/httpd-vhosts.conf:
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName localhost:80
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>
<VirtualHost mysite.local>
ServerName mysite.local
DocumentRoot "C:/xampp/htdocs/mysite.local"
</VirtualHost>
Hope someone can tell me what I do wrong here. The site works o.k. for the static pages when I have no rewrite stuff in the .htaccess file, but due to using search engine friendly urls, I need to add the rewrite functionality.
Thanks :)
So how can I repair Apache? And after this has been done, activate mod_rewrite?
The first stop when encountering *any* error is your server error log file; It will often tell you exactly what's wrong.
In order to use mod_rewrite in httpd.conf, the module must be installed, and "Options FollowSymLinks" or "Options SymLinksIfOwnerMatch" must be set in the appropriate container
For use in .htaccess with "Options FollowSymLinks" and "Options SymLinksIfOwnerMatch" not already set in httpd.conf (or conf.d, etc.), "AllowOverrides Options" must be set, so that "Options FollowSymLinks" or "Options SymLinksIfOwnerMatch" can be set in .htaccess.
I'd recommend shutting down Apache, restoring httpd.conf from a backup, and starting over in this case.
Jim