使用URL .htaccees删除字符串 [英] Remove string from URL using .htaccees

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

问题描述

我已经成立了一个bit.ly短链接,党和印刷它1000传单。 不知怎的,bit.ly目标链接包含一些字符串,不应在那里,我不知道为什么。

I've set up a bit.ly short link for a party and printed it on 1000 flyers. Somehow the bit.ly target link contains some strings which shouldn't be there and I have no idea why.

那么,什么情况是:它重定向到 http://example.com/page/ %E2 %80%8E。请参阅%E2%80%8E? 当然,这会导致一个404错误...

So what happens is: It redirects to "http://example.com/page/ %E2%80%8E". See that "%E2%80%8E"? Of course it causes a 404 error...

我的问题是:我可以摆脱使用.htaccess文件这个字符串的?如果是的,我有什么写?

My question is: Can I get rid of this string using the .htaccess file? And if yes, what do I have to write?

任何帮助是AP preciated!

Any help is appreciated!

(不幸的是我没有这些东西好,这就是为什么我不能用计算器上关于htaccess的重写的许多问题之一。) 谢谢大家!

(Unfortunately I'm not good in these things and thats why I can't use one of the many questions on stackoverflow about htaccess rewriting.) Thank you very very much!

推荐答案

当你刚刚不小心添加字符串的%20%E2%80%8E 的在创建短链接,那么你就可以刚刚得到另一个短链接不小心再次添加字符串。

When you just accidentally added the string %20%E2%80%8E in the creation of the short link, then you can just get another short link without accidentally added the string again..

不管怎样,我想这些的的.htaccess 的指令是你想要的:

Anyway, I think these .htaccess directives are what you want:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9_-]+)\%20\%E2\%80\%8E$
RewriteRule ^(.*) http://medien-mittweida.de/%1 [R,L]

这将重定向的 medien-mittweida.de/的 $什么%20%E2%80%8E 的成的 medien-mittweida.de / $ 什么

It will redirect medien-mittweida.de/$anything%20%E2%80%8E into medien-mittweida.de/$anything

只要确保有 Apache HTTP服务器的mod_rewrite 您的网络托管帐户。并认为有关 [R = 301] 标记此链接:<一href="http://stackoverflow.com/a/15999177/2007055">http://stackoverflow.com/a/15999177/2007055

Just make sure that there's Apache HTTP Server with mod_rewrite on your web hosting account. And considered this link about the [R=301] flag: http://stackoverflow.com/a/15999177/2007055

这code:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9_-]+)/\%20\%E2\%80\%8E$
RewriteRule ^(.*) http://medien-mittweida.de/%1/ [R,L]

是重定向的 medien-mittweida.de/的 $什么 /%20%E2%80%8E 的成的 medien-mittweida.de / $ <强>什么 / 的。

Is to redirect medien-mittweida.de/$anything/%20%E2%80%8E into medien-mittweida.de/$anything/.

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

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