Created
July 17, 2012 13:42
-
-
Save JossWhittle/3129458 to your computer and use it in GitHub Desktop.
HTACCESS file with URL Rewrite
This file contains 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
Options +FollowSymlinks | |
RewriteEngine on | |
RewriteRule ^post/([0-9]+)(:?\/[a-zA-Z0-9_]*)?(:?\/.*)?$ /index.php?id=$1 | |
RewriteRule ^post/([a-zA-Z]+)/([0-9]+)(:?\/[a-zA-Z0-9_]*)?(:?\/.*)?$ /index.php?filter=$1&value=$2 |
This file contains 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
<?php | |
// Parses the title string to make it url/seo friendly | |
// Returns thed scrubbed string | |
function parseTitle($str) { | |
$str = preg_replace("/[^a-zA-Z0-9_\s]+/i", '', $str); | |
$str = preg_replace("/\s+/i", '_', $str); | |
return $str; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment