[英]How to replace the underscore with Hyphen using Htaccess rule
How to replace the underscore with Hyphen using Htaccess rule 如何使用Htaccess规则用下划线替换下划线
Here is link: 这里是链接:
http://iloansdirect.netsmartz.us/property_finder.shtml http://iloansdirect.netsmartz.us/property_finder.shtml
I want to below link: 我要下面的链接:
http://iloansdirect.netsmartz.us/property-finder.shtml http://iloansdirect.netsmartz.us/property-finder.shtml
Try below code in htaccess file: 尝试下面的htaccess文件中的代码:
RewriteEngine On
RewriteRule ^(.*)_(.*)$ /$1-$2 [L,R=301]
You can check below 您可以在下面查看
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]
found at http://www.askapache.com/htaccess/rewrite-underscores-hyphens-seo-url.html 可在http://www.askapache.com/htaccess/rewrite-underscores-hyphens-seo-url.html找到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.