htaccess的更换空间的网址和重定向 [英] htaccess to replace space in url and redirect

查看:160
本文介绍了htaccess的更换空间的网址和重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手,想解决的一个问题。 我读了同样的问题,但误解:

I am newbie and want to solve a problem. I read same question but misunderstand:

htaccess的重定向URL与它的空间

请帮助我。 我的网站用字preSS与自定义字段和标签。

Please help me. My site use wordpress with custom fields and tags.

自定义字段让很多环节,如:

Custom Fields make lot of link such as:

http://domain.com/tag/Miss Earth
http://domain.com/tag/Miss World
http://domain.com/tag/Miss England
...

(空间不是20%) 五言的,我也创建标签:地球小姐,世界小姐,英国小姐......但上面的链接不存在(空格(),必须改为 - 和M的M和E由E......

(Space not %20) Of cource I also create tags: Miss Earth, Miss World, Miss England... but above links are not exist (space (" ") must be replaced by "-" and "M" by "m" and "E" by "e"...

我需要使用htaccess的更换空间()字符为 - ,并自动重定向到真正的标签:

I need use htaccess to replace space (" ") character to "-" and auto redirect to really tags:

http://domain.com/tag/miss-earth
http://domain.com/tag/miss-world
http://domain.com/tag/miss-england

请帮我清楚了,我笨与htaccess的。

Please help me clearly, I am stupid with htaccess.

感谢

推荐答案

尝试在你的文档根目录下添加这些规则的htaccess文件,preferably高于已经在文件中的任何字preSS的规则:

Try adding these rules to the htaccess file in your document root, preferably above any wordpress rules that are already in the file:

RewriteEngine On
RewriteRule ^/?tag/(.*)\ (.*)$ /tag/$1-$2   [L,R=301]

这篇关于htaccess的更换空间的网址和重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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