ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Any help on how to make a short URL on PHP with Code Igniter?

October 04, 2010 6:49pm

Subscribe [4]
  • #1 / Oct 04, 2010 6:49pm

    Mister Ed

    2 posts

    Hi there,

    Myself and my webmaster are exploring codeigniter and PHP. My website has a search engine using PHP therefor all the files have to sit on the Application folder

    /public_html/system/application/views/application

    Thats all and dandy but lately is getting crowded with so many pages, so I wish to make each section have its own direct URL.

    At present my website have the following URLs

    http://www.mywebsite.com/index.php/application/administration
    http://www.mywebsite.com/index.php/application/contact
    http://www.mywebsite.com/index.php/application/accounting

    I like to change the URLs to:

    http://www.mywebsite.com/administration
    http://www.mywebsite.com/contact
    etc etc

    The application.php file sits at >> /public_html/system/application/controllers

    The question is what changes and what files need to be changed so as to reflect the new URLs.

    Please help.

    Mister Ed

  • #2 / Oct 04, 2010 7:32pm

    Mischievous

    84 posts

    First off, you need to overlook: http://ellislab.com/codeigniter/user-guide/general/urls.html ... will give some useful information on how to get that index.php out of your url.

    Second, your files should be like:
    /public_html/system/application/controllers/administration.php
    /public_html/system/application/controllers/contact.php
    /public_html/system/application/controllers/accounting.php

    Inside each controller your index() files would represent

    http://www.mywebsite.com/administration
    http://www.mywebsite.com/contact
    http://www.mywebsite.com/accounting

    And… done 😉

  • #3 / Oct 05, 2010 6:22am

    Crimp

    320 posts

    Mister Ed,

    You may also look at routes in CI. This basically allows you to route your application to ANY URI scheme. Routes are always checked so the “overhead” is already there.

  • #4 / Oct 05, 2010 2:51pm

    Mister Ed

    2 posts

    In respect to the route, one would have to enter extra script lines in the file routes.php? Sorry about the dam questions but my friend and I are new to Code Igniter and PHP, so we are taking baby steps here.

    Our aim like stated before is to have the URLs as short as possible.


    Ed

  • #5 / Oct 05, 2010 5:20pm

    Mischievous

    84 posts

    Yes, you would have to add an extra line to routes.php file

  • #6 / Oct 15, 2010 5:47am

    Msnbags088

    2 posts

    Whilst the majority of the css in my site is either embedded in the view files or generated using php, there are still some ‘standard’ files which don’t need to be run through the framwork - css reset, and grid etc.

  • #7 / Apr 20, 2011 2:56pm

    wizardianx

    4 posts

    check this out ->http://ellislab.com/codeigniter/user-guide/general/routing.html

  • #8 / Dec 21, 2011 7:47pm

    wizardianx

    4 posts

    check this out ->http://ellislab.com/codeigniter/user-guide/general/routing.html :p

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases