SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: friendly url

  1. #1
    Non-Member
    Join Date
    Apr 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    friendly url

    Hello,
    I want to make my php based script's url search engin friendly,as i know
    nothing about .htaccess, can anyone one hints me about the code in the .htaccess

    http://127.0.0.1/one/index?base=one&script=comment

    ignore 127.0.0.1/one/

    the actual url is index?default&base=one&script=comment where "one" is the folder name and comment
    is the script on that folder.default is fixed all time. so those url parse in a functin and base and script variable i caught via request in a file which inlude in the very begining of the execution.

    So suppose i want visitor to type
    http://127.0.0.1/one/comment
    but it's actual url is
    http://127.0.0.1/one/index?base=one&script=comment

    and another one like

    http://127.0.0.1/one/profile

    but it's actual url is

    http://127.0.0.1/one/index?base=system&script=profile

    can anyone hinst me about the htaccess code for this along with the regular expression

    thank you all

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, as the 'base' varies you need to define specific rules:
    Code:
    RewriteEngine On
    RewriteRule ^comment/?$ index?base=one&script=comment
    RewriteRule ^profile/?$ index?base=system&script=profile
    If the base didn't change, i.e. was always system, I'd use:
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (\w+)/? index?base=system&script=$1
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    exu,

    Where's the file extension for "index"? Making an extensionless file parse as PHP is a nasty trick and it's evident that you're not doing that.

    Tutorial? Why not look at my signature?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    Non-Member
    Join Date
    Apr 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Arkinstall

    Works perfectly.thanx for starting me. that's called help.

    and

    Dklynn
    when i typed mistakenly .php was not there typing mistake its was actually index.php?base=one&script=comment

    you have a great tutorial of seo in your signature. thank you man


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
  •