Posted By

LeeRJohnson on 09/16/10


Tagged

server htaccess apache web underscores hyphen


Versions (?)

Rewrite underscores to hyphens for SEO URL


 / Published in: XML
 

URL: http://www.askapache.com/htaccess/rewrite-underscores-to-hyphens-for-seo-url.html

  1. Options FollowSymLinks
  2. RewriteEngine On
  3. RewriteBase /
  4.  
  5. RewriteRule !\.(html|php)$ - [S=6]
  6. RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6-$7 [E=underscores:Yes]
  7. RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6 [E=underscores:Yes]
  8. RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=underscores:Yes]
  9. RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=underscores:Yes]
  10. RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=underscores:Yes]
  11. RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=underscores:Yes]
  12.  
  13. RewriteCond %{ENV:underscores} ^Yes$
  14. RewriteRule (.*) http://www.askapache.com/$1 [R=301,L]

Report this snippet  

You need to login to post a comment.