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.

Im starting with Zend Framework, and on their site there is this:

http://framework.zend.com/manual/en/zend.controller.html#zend.controller.quickstart.go.rewrite

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

How to put that to good use? What should i do to get this to work? Now when i load my site i get 500 internal server error... :)

Should i change REQUEST_FILENAME to something else?

Im still very new to htaccess and mod_rewrite...

Im using WAMPSERVER...

share|improve this question
    
That site seems to be down, could you post your the contents of your .htaccess file? I'd be more than happy to help –  TrueDuality Sep 18 '09 at 19:23
    
I added content of .htaccess to my question. –  Gavrisimo Sep 18 '09 at 19:35
    
If I'm getting it right it is doing this: Don't match the case, but match anything. If the file/directory is greater than zero, or the file is a link, or the file is a directory. Do nothing with it (end writing rules). Next set: Rewrite the name of any other request to be index.php –  TrueDuality Sep 18 '09 at 20:06

6 Answers 6

up vote 2 down vote accepted

Apparently I overlooked the most obvious answer: I just changed this:

#LoadModule rewrite_module modules/mod_rewrite.so

to this:

LoadModule rewrite_module modules/mod_rewrite.so

in the httpd.conf file. Everything works now.

share|improve this answer
    
:) ..We've all had those moments –  warren Oct 1 '09 at 12:30

internal server error means there is an error in your .htaccess

Try to remove it, just to see if the problem disapear. In this case add your lines in order to find which is defective

share|improve this answer

There are many ways to get Error 500 with .httaccess. Maybe you have set wrong permissions on the file or you have a typo in it.

share|improve this answer
    
I dont think its the permissions, it is all on my PC, in local... :) –  Gavrisimo Sep 18 '09 at 19:37
    
On Linux it does matter but since you use WAMP than this may not be the case. Just to be sure you could try to log on via FTP (yes, on the local machine) and check this twice. –  minder Sep 18 '09 at 19:41

So I think I see what your getting at. Your basically trying to rewrite any requests that don't exist to another page. Rather than what your doing, I would try this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /index.php [NC,L]

This will only match if the file/directory/link does not exist and rewrite it to point at the index page.

share|improve this answer
    
BTW I did try the rules you posted and I didn't receive an error. They worked in a LAMP setup, but I'm willing to bet that the rule with no conditions is causing some trouble. Give the one I posted a try. –  TrueDuality Sep 18 '09 at 20:13

You should check your server error logs for details. For Apache this is usually %APACHE_DIR%\logs\error.log (on Windows) or /var/logs/apache/error.log on Linux.

share|improve this answer

I have added following redirect rule, the redirect works fine but the URL in the address bar doesnot print or looks as required.

RewriteRule ^(a-z).htm http:/localhost/info/mystuff.php?tech=$1 [L]

I want my URL to be like http://localhost/info/w3calculator

but it prints as http:/localhost/info/mystuff.php?tech=w3calculator

I think this is server issue how do I fix it?

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.