本文介绍了如何使用 Htaccess 规则用连字符替换下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Htaccess 规则用连字符替换下划线
How to replace the underscore with Hyphen using Htaccess rule
这是链接:
http://iloansdirect.netsmartz.us/property_finder.shtml
我想要以下链接:
http://iloansdirect.netsmartz.us/property-finder.shtml
推荐答案
您可以在下方查看
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule !\.(html|php)$ - [S=6]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6-$7 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=underscores:Yes]
RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=underscores:Yes]
RewriteCond %{ENV:underscores} ^Yes$
RewriteRule (.*) http://www.askapache.com/$1 [R=301,L]
位于 http://www.askapache.com/htaccess/rewrite-underscores-hyphens-seo-url.html
这篇关于如何使用 Htaccess 规则用连字符替换下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!