regex - 301 redirect for url containing underscores -


i want to

redirect /directsystems/education/index/name/system_one

to

http://www.mysite.com/directsystems/education/index/name/system-one

can please show me 301 redirect rule htaccess? want redirect undescores hypens

to replace underscores _ hyphen - in uri, use following rules in .htaccess file:

options +followsymlinks -multiviews rewriteengine on  rewriterule ^([^\_]+)_([^\_]+)(_.*)$ /$1-$2$3 [n,dpi] rewriterule ^([^\_]+)_(.*)$ /$1-$2 [l,r=301,dpi] 

this redirects url of:

http://localhost/directsystems/education/index/my_name/system_one

to

http://localhost//directsystems/education/index/my-name/system-one


Comments