本文介绍了变化强调要与文件名的URL连字符开头的字文章的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用一些code我的计算器在别处找到了,但我想修改它,我不知道怎么办。
I tried using some code I found elsewhere on stackoverflow, but I want to modify it, and I don't know how.
RewriteRule ^([^_]*)_+(.*)$ $1-$2 [E=underscores:Yes,N]
RewriteCond %{ENV:underscores} ^Yes$
RewriteRule ^(.+)$ /$1 [R=301,L]
这改变了这一切下划线连字符。但是,我需要限制这组语句只网址开头:
This changes all underscores to hyphens. However, I need to limit this set of statements to only URLs that begin:
HTTP://www.mydomain.tld/article ...
在换句话说,规则应当只有当该文件名开头单词文章中应用
In other words, the rules should only apply when the file name begins with the word article.
有人能帮助?
推荐答案
试试这个,看看这个,看看它是否适合你。
Try this and see if this and see if it works for you..
RewriteRule ^([^_]*)_+(.*)$ $1-$2 [E=underscores:Yes,N]
RewriteCond %{ENV:underscores} ^Yes$
RewriteRule ^article(.+)$ /article$1 [R=301,L]
这篇关于变化强调要与文件名的URL连字符开头的字文章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!