RedirectMatch 301 结尾不带变量的通配符
如何使用通配符重定向一组页面,并且末尾不附加变量?例如,下面的 .htaccess 代码:
RedirectMatch 301 /general/old_events_page.php(.*) http://mysite.org/events
产生:
mysite.org/events?id=749&Friendly=1&date=20090308
但我只想它转到 http://mysite.org/events
How do You do a re-direct a group of pages with a wildcard that doesn't attach the variables at the end? For example, the .htaccess code below:
RedirectMatch 301 /general/old_events_page.php(.*) http://mysite.org/events
Yields this:
mysite.org/events?id=749&friendly=1&date=20090308
But I just want it to go to http://mysite.org/events
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这个 mod_rewrite 规则:
Try this mod_rewrite rule:
您需要使用 RewriteCond + RewriteRule 来实现此目的。
RewriteCond 评估规则应用的条件
RewriteRule 是规则本身
无论如何......这应该是技巧;
You'll need to use RewriteCond + RewriteRule to achieve this.
RewriteCond evaluates the conditions for which the rule applies
RewriteRule is the rule itself
Anyway... This should the trick;