Constructing a URL

Discussion in 'PHP' started by Jim bob 9 pants, Dec 5, 2005.

  1. #1
    Hi all

    I am getting some help with SEO and I am trying to build a URL.

    On my site if you click on a county, you can then click on an area... and then on a town.... , my data base holds the town name and the area name can I bring the info I need to the page, so I can construct the URL ?

    ie currently

    visitdevonandcornwall.com/town/Drym

    to

    visitdevonandcornwall.com/Cornwall/kerrier/Drym

    any help would be great

    Thanks

    JB9P
     
    Jim bob 9 pants, Dec 5, 2005 IP
  2. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    keyword: "mod_rewrite", numerous times spoken already....
     
    boccio, Dec 6, 2005 IP
  3. Jim bob 9 pants

    Jim bob 9 pants Peon

    Messages:
    890
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I can use rewrite, but how do I dynamically create the URL?
     
    Jim bob 9 pants, Dec 6, 2005 IP
  4. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #4
    Is there a place where you can pull the Cornwall from?
     
    palespyder, Dec 6, 2005 IP
  5. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #5
    Just looked at your site, I would rewrite the URL AcommodationCornwall.php to /Cornwall, the add the secondary /Cornwall/Kerrier and finally the town /Cornwall/Kerrier/Helford

    This might take you some time, but, you can actually do the entire thing with rewrites
     
    palespyder, Dec 6, 2005 IP
  6. Jim bob 9 pants

    Jim bob 9 pants Peon

    Messages:
    890
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi, that is kinda what I started here

    http://www.test.visitdevonandcornwall.co.uk/

    I cannot pull Devon or Cornwall, but can pull most other terms

    I am currntly using this

    And trying to make this work

    using a rewrite like this

    That will write a URL like /Kerrier/Helston/Hotel/74, But I am getting errors, it wount show me the page, I guess thats not how its done ??
     
    Jim bob 9 pants, Dec 6, 2005 IP
  7. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #7
    try changing the $1 into $4 in the rewrite and tell me what you get.
     
    palespyder, Dec 6, 2005 IP
  8. Jim bob 9 pants

    Jim bob 9 pants Peon

    Messages:
    890
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I have just tried and get this

    Any ideas
     
    Jim bob 9 pants, Dec 7, 2005 IP
  9. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #9
    Well it appears you have 4 different variables being passed in the above rewrite, try them all $1, $2, $3, $4, it's hard to distinguish how this is supposed to work without looking at the code. you can email me privately at jason.lewis @ gmail.com if you want to discuss it, or is you want to send me your code so I can have a look.
     
    palespyder, Dec 7, 2005 IP
  10. Jim bob 9 pants

    Jim bob 9 pants Peon

    Messages:
    890
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #10
    E-mail sent, with files attached!
     
    Jim bob 9 pants, Dec 7, 2005 IP