Welcome Guest, Not a member yet? Register   Sign In
Changing underscores to dashes
#1

[eluser]wakey[/eluser]
Before upgrading to Codeigniter 2.0, I was able to use dashes in URLs with this myhooks.php file that someone provided on these forums. I have enabled hooks but am getting 404 errors when I try to use dashes in URLs. Does anyone know what's changed?

myhooks.php

Code:
<?php
function prettyurls() {
    if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') {
        $newkey = str_replace('-','_',key($_GET));
        $_GET[$newkey] = $_GET[key($_GET)];
        unset($_GET[key($_GET)]);
    }
    if (isset($_SERVER['PATH_INFO'])) $_SERVER['PATH_INFO'] = str_replace('-','_',$_SERVER['PATH_INFO']);
    if (isset($_SERVER['QUERY_STRING'])) $_SERVER['QUERY_STRING'] = str_replace('-','_',$_SERVER['QUERY_STRING']);
    if (isset($_SERVER['ORIG_PATH_INFO'])) $_SERVER['ORIG_PATH_INFO'] = str_replace('-','_',$_SERVER['ORIG_PATH_INFO']);
    if (isset($_SERVER['REQUEST_URI'])) $_SERVER['REQUEST_URI'] = str_replace('-','_',$_SERVER['REQUEST_URI']);
}




Theme © iAndrew 2016 - Forum software by © MyBB