• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Site Migrate

Ok, i have looked at the documentation, and i'm a little confused.

I have an existing site that is built in php.

I want to move this site to code igniter, but i would like to migrate it slowly, so that i co-exists nicely with my other code igniter application.

So, i'm attempting to follow the instructions: http://codeigniter.com/wiki/site_migrate/

i created the directory system/application/views/site_migrate

Now i'm to the point where the index.php page pulls up, but it can't located the css files also the image files.

do i need to modify the site to have specific path?

also from my menu, how to i refer to the pages? example about.php this file used to be in the docroot. now if i click on the menu item, it's still thinks its located in the docroot. do i need to make a change there also?

thanks for you help.


Use absolute paths for your images and css files, etc.

If your website URL is http://yoursite.tld/index.php/controller/method and you have an img tag using a relative path:

<img src="images/blinking.gif">

Than your browser will try to find it under http://yoursite.tld/index.php/controller/images and that is just not right. Smile

Just put a beginning slash before your images folder to designate the website root path. ie:

<img src="/images/blinking.gif">

Probably as simple as that.

You might want to take a look at the method we use at Isset for migrating websites to CodeIgniter.

n0xie: do you have a sample of the My_Router that you built?

class MY_Router extends CI_Router {

  function MY_Router()

  // copy pasted from original Router.php

      function _validate_request($segments)
        // Does the requested controller exist in the root folder?
        if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
            return $segments;

        // Is the controller in a sub-folder?
        if (is_dir(APPPATH.'controllers/'.$segments[0]))
            // Set the directory and remove it from the segment array
            $segments = array_slice($segments, 1);
            if (count($segments) > 0)
                // Does the requested controller exist in the sub-folder?
                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
                // Does the default controller exist in the sub-folder?
                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
                    $this->directory = '';
                    return array();

            return $segments;

    /* this is the only bit you want to change.
     * normally CI will send a 404 when no controller is found
     * instead we are going to redirect to the oldsite

        // Can't find the requested controller...
                // this depends on how you setup your oldsite:
                $ext_url = 'http://'. $_SERVER['SERVER_NAME'] . '/oldsite' . $_SERVER["REQUEST_URI"];
              header ('HTTP/1.1 301 Moved Permanently');
              header ('Location: '.$ext_url);

I'm having some issues with this..

would you be able to share what the index.php looks like?

i have found my issue. thanks so much for all your help.

No problem. Hope it was useful.


for future reference here is the link to the site_migrate wiki forum thread:

the wiki articles all have forum threads. i just stumbled on this by accident... glad you worked it out!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.