使用URL htaccess的结束删除Word [英] Remove word from end of URL using htaccess

查看:191
本文介绍了使用URL htaccess的结束删除Word的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆上来的网址... /不确定它得到一个404错误,我想知道如何使用的.htaccess从URL的末尾删除单词未定义

I have a bunch of URLs coming up as .../undefined which get a 404 error, and I'd like to know how to removed the word "undefined" from the end of the URL using .htaccess

我已经看过很多帖子有关删除扩展,查询和URL内部的文件夹,并试图适应这些规则,以适应我的目的,但到目前为止,我还没有能够使它发挥作用。任何想法?

I have looked at many posts about removing extensions, queries, and URL-internal folders, and have tried adapting those rules to suit my purposes, but so far I haven't been able to make it work. Any ideas?

样品网址:<一href="http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/undefined" rel="nofollow">http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/undefined

我只是想单词未定义被剥离出来,使用户被自动重定向到的http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/

I just want the word "undefined" to be stripped out so that the user is automatically redirected to http://www.theveggietable.com/blog/vegetarian-recipes/sandwiches/true-veggie-burgers/

谢谢!

推荐答案

尝试:

RewriteEngine On
RewriteRule ^(.*)/undefined/?$ /$1/ [L,R=301]

RedirectMatch 301 ^/(.*)/undefined/?$ /$1/

这篇关于使用URL htaccess的结束删除Word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆