.htaccess 帮助 RewriteRule
我有一个问题,惊讶;)
我在 Apache 中使用 .htaccess 并有一个 RewriteRule 问题
我的代码是
RewriteRule ^(.*)$ /system/header_codes.php?oldurl=$1
如果它没有真正的( rewriterule )我该如何制作所以使用这个,我将使用它因为我创建了一个动态 RewriteRule对于我的系统中的客户?
我希望在这里得到帮助,对于拼写错误表示歉意。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可能离这里很远,因为我几乎不明白你在问什么,但这也许会有所帮助。这是我用来将所有内容发送到我的请求处理程序(index.php)的重写规则。它不会重定向 css、图像等文件,因此也许您可以使用该逻辑来排除其他模式。
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.
您的问题有点难以理解,但如果我没有记错的话,如果重写规则不匹配,您希望将用户重定向到自定义页面。
现在我将解释这个问题:
重写规则旨在拦截对某些URL的请求并将它们重定向到另一个页面。如果规则不匹配,则不会发生并且网络服务器会正常处理请求。
您可以做的是在 .htaccess 文件中设置一条规则,将对不存在页面的请求重定向到另一个文件。 (请参阅此处)
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)