Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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 9 '10 at 8:29
    
just updated the post with the apache error log, any ideas please –  amir Jan 9 '10 at 8:36
add comment

migrated from stackoverflow.com Jan 9 '10 at 14:34

This question came from our site for professional and enthusiast programmers.

2 Answers

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

share|improve this answer
    
hi, thanks for the reply, just updated the ,htaccess above. –  amir Jan 9 '10 at 8:26
    
So why the down vote? You didn't have any of the .htaccess in your original question. –  DeveloperChris Jan 9 '10 at 9:39
add comment

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.

share|improve this answer
    
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 –  amir Jan 9 '10 at 9:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.