Last active
August 29, 2015 14:05
-
-
Save hmngwy/e1bad35ddcc6431d07d3 to your computer and use it in GitHub Desktop.
mod_rewrite directives for underscore-separated-paths into dashes, in .htaccess, without any site file changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{QUERY_STRING} !(.*)r=1(.*) | |
RewriteCond %{REQUEST_URI} ^(.*)html$ | |
RewriteCond %{REQUEST_URI} ^(.*)_(.*)$ | |
RewriteRule (.*)_(.*) http://www.example.com/$1-$2 [L,R=301] | |
RewriteCond %{REQUEST_URI} ^(.*)-(.*)$ | |
RewriteRule (.*)-(.*) /$1_$2?r=1 [L] | |
RewriteCond %{QUERY_STRING} !(.*)r=1(.*) | |
RewriteCond %{REQUEST_URI} ^(.*)html$ | |
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)$ | |
RewriteRule (.*)_(.*)_(.*) http://www.example.com/$1-$2-$3 [R=301] | |
RewriteCond %{REQUEST_URI} ^(.*)-(.*)-(.*)$ | |
RewriteRule (.*)-(.*)-(.*) /$1-$2-$3 [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment