Welcome Guest, Not a member yet? Register   Sign In
So close with a mod_rewrite that changes underscores to hyphens for SEO. Can anyone close it out?
#16

[eluser]jaysonic[/eluser]
Another solution, which has been posted although it modifies all the segments, is as follows.

Create the MY_Router.php file in /application/core and in it place the following code:
Code:
<?php
public function _set_request($segments){
    // Fix only the first 2 segments
    for($i = 0; $i < 2; ++$i){
        if(isset($segments[$i])){
            $segments[$i] = str_replace('-', '_', $segments[$i]);
        }
    }
    
    // Run the original _set_request method, passing it our updated segments.
    parent::_set_request($segments);
}
?&gt;

This just modifies the first 2 segments in your URL, but only if they are set. Hopefully that helps someone.


Messages In This Thread
So close with a mod_rewrite that changes underscores to hyphens for SEO. Can anyone close it out? - by El Forum - 05-08-2011, 04:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB