Results 1 to 3 of 3

Thread: URL rewriting

  1. #1
    Join Date
    Mar 2007
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default URL rewriting

    hi,

    can any1 help me with the method of rewriting url. i have a site which i have to redo in php. there is 1500 pages in the original site.
    So i was wondering if i could make my work easier by url rewriting, but am not sure how to go about it.

    appreciate your help..Suk

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, I don't know what you mean, I think you mean something like this at the end for your url:
    Code:
    site.com/?p=home
    But theres also mod rewrite that'll turn the above to:
    Code:
    site.com/p/home
    So, search mod rewrite.
    You can aslo make example#1 like this:
    PHP Code:
    if($_GET['page'] == "home"){
    echo 
    "Home";

    The you go to:
    Code:
    site.com/?page=home
    Then if you don't really wanna make a million of these ifstatements then you can use switch.
    PHP Code:
    switch($_GET['page']){
    case 
    'home':
    echo 
    'Home';
    case 
    'contact':
    echo 
    'Contact!';
    default:
    echo 
    'Home!';

    For more info on the switch() function, go to http://us.php.net/switch
    Last edited by Nile; 04-02-2008 at 11:50 AM.
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    If you use an apache webserver using rewriterule is easier

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •