开发者

.htaccess help to RewriteRule

开发者 https://www.devze.com 2022-12-26 17:06 出处:网络
I have a problem, surprise ;) I use .htaccess in Apache and have a RewriteRule problem My code is 开发者_运维技巧RewriteRule ^(.*)$/system/header_codes.php?oldurl=$1

I have a problem, surprise ;)

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 it did not have a true ( rewriterule ) so use this, I will use it becures i create a dyanmic RewriteRule for my customer in my System?

i hope for help here, sorry for bad spelling.


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]


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号