Php – problem with enableing apache mod rewrite on xampp

apache-2.2PHPxamppzend-framework

I'm trying to enable the mod rewrite on apache for xampp, I've uncommented the code

LoadModule rewrite_module modules/mod_rewrite.so

also I have the AllowOverride All as well but it's still not working,

I get the error 400 which says

Bad request!

Your browser (or proxy) sent a request that this server could not understand.

so I tried to install the zend server community edition which has apache in it, and I did all the following and the url rewriting works but this time the public folder inside the web application is hidden in apache, and when I try to copy the content of the public folder and access it in the root I get the error 500 which says

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

I'd appreciate it if some one can help me setup one of these, I'm trying to use the zend framework.

thanks

.htaccess

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

php_flag short_open_tags on

apache error log:

Invalid URI in request GET
/webfolder/zf-tutorial/public/index/add
HTTP/1.1, referer:
http://localhost/webfolder/zf-tutorial/public/

update:
I moved the webapplication to the htdocs in apache and everything is working now, I was pointing the root to the following directory before

Alias /webfolder/ "C:/Users/Amir/Documents/webfolder/" 
Alias /webfolder "C:/Users/Amir/Documents/webfolder" 

any ideas why it wasn't working before. thanks

Best Answer

AllowOverride enables .htaccess files. my guess is you have a bad .htaccess in the path of the website.

If you have some invalid syntax in the .htaccess file you will get a server 500 error.

turning on rewrites also is not enough you have to add the line RewriteEngine On to either your virtualhost or .htaccess file and then follow it with your rewrite rules

DC

Related Topic