views:

41

answers:

2

Hello all

I have a problem, suprice ;)

i use .htaccess in Apache and have a RewriteRule problem

my code is

RewriteRule ^(.*)$       /system/header_codes.php?oldurl=$1

how can i make if its not have a true ( rewriterule ) soe use this, i will use its becures i create a dyanmic RewriteRule for my customer in my System.

i hobe for help here, sorry for bad spelling.

A: 

Your question is a little hard to understand, but if I'm not mistaken, you want to redirect the user to a custom page IF the rewrite rule is not matched.

Now I will explain the problem with that:

The rewrite rule is designed to intercept requests to certain URLs and redirect them to another page. If the rule is not matched, nothing happens and the request is handled normally by the webserver.

What you can do, is set a rule in your .htaccess file to redirect requests to nonexistent pages to another file. (See here)

George Edison
+1  A: 

I might be way off here becuase I barely get what you're asking, but maybe this will help a little. It's the rewrite rule I use to send everything to my request handler (index.php). It doesn't redirect css, image, etc files, so maybe you can use that logic to exclude other patterns.

RewriteRule !(\.(css|jpg|png|gif|jpeg|js|swf))$ index.php [NC]
Syntax Error