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 want to redirect all requests for NOT(main.php) to handelrequest.php?page=[page]
So it must be something like:

RewriteRule !(main.php) handlerequest.php?page=$1

or

RedirectMatch !(main.php) handlerequest.php?page=$1

but it seems, that those modules haven't negation at all...

May be it is possible to combine it. Some thing like:

RewriteRule (main.php\?.*) $1
RewriteRule (*) handlerequest.php?page=$1

If not main.php, else for all others the second rule become active.
Is there some solution?

Thank you for ahead.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !main.php
RewriteRule ^(.*)$ handlerequest.php?page=$1

That says.. if the requested filename is main.php don't run the rule.. for everything else run the rule.

share|improve this answer
    
Thank you very much, it work!!! :) –  Rodnower Nov 29 '10 at 13:00
    
It is also possible to add $ to !main.php to be more exact. –  Rodnower Nov 29 '10 at 13:01

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.