Forums

Give help. Get help.

  • # March 20, 2013 at 2:49 pm

    You aren’t giving me much to work with.

    Try debugging yourself by placing echos and var_dumps on crucial places (where things might go wrong) so you know where and why things go wrong. I recommend `var_dump($page)` right before your switch since that seems to be the problem.

    # March 20, 2013 at 3:59 pm

    I think I may just go ahead and handle the error page through .htaccess

    # April 3, 2013 at 11:07 am

    Hi there

    I have a solution to your problem:

    In your .htaccess file ensure you have the following:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L,QSA]

    Then go to your index.php and add the following:

    list($path) = explode('?', $_SERVER);
    //Remove script path:
    $path = substr($path, strlen(dirname($_SERVER))+1);
    //Explode path to directories and remove empty items:
    $pathInfo = array();
    foreach (explode('/', $path) as $dir)
    {
    if (!empty($dir))
    {
    $pathInfo[] = urldecode($dir);
    }
    }

    if (count($pathInfo) > 0)
    {
    //Remove file extension from the last element:
    $last = $pathInfo[count($pathInfo)-1];
    list($last) = explode('.', $last);
    $pathInfo[count($pathInfo)-1] = $last;
    }

    Do a print_r on $pathInfo will show you everything within the URL

    Now you make all your URLS point:
    http://localhost/

    /index/

    # April 3, 2013 at 11:09 am

    Sorry the above should be:

    http://localhost/<dir>/index/<page&gt;

Viewing 4 posts - 61 through 64 (of 64 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag