0

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

  • You need to inspect Apache error logs to see what the error exactly is. XAMPP menu in Start Menu > Programs contains an entry for viewing Apache error log. Post the most recent error messages along with your question. – Salman A Jan 09 '10 at 08:29
  • just updated the post with the apache error log, any ideas please –  Jan 09 '10 at 08:36

2 Answers2

1

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

1

Your rewrite rules are conflicting and in the wrong order. All rewrite Rules must come after the RewriteEngine directive.

Lose the first line, and remove the relative path from your last RewriteRule:

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]

This .htaccess should be in your public/ directory.

Please see the manual. Throwing more RewriteRules at it is not the solution.

hobodave
  • 2,840
  • 2
  • 24
  • 34
  • 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 –  Jan 09 '10 at 09:07