How to create vanity in coding

How can I create a vanity url in codeigniter. I am having real problems with this in the framework. And there don't seem to be any good answers.

+2


a source to share


2 answers


I may be using this in one of my projects ...

Here's a thread on the CodeIgniter forums showing how to do this ...



http://codeigniter.com/forums/viewthread/113962/

+2


a source


According to Personalized User URL in CodeIgniter , you can accomplish this by modifying your routes file:



$handle = opendir(APPPATH."/modules");
while (false !== ($file = readdir($handle))) {
  if(is_dir(APPPATH."/modules/".$file)){
    $route[$file] = $file;
    $route[$file."/(.*)"] = $file."/$1";
  }
}

/*Your custom routes here*/

/*Wrap up, anything that isnt accounted for pushes to the alias check*/
$route['([a-z\-_\/]+)'] = "aliases/check/$1";

      

+1


a source







All Articles