URL detect for folders

Discussion in 'PHP' started by static1635, Aug 4, 2006.

  1. #1
    Hi

    How can I make the script for detecting different folders in order to have the URL change? For example so I can link to the homepage and the URL will be correct regardless of what folder the current page is being served from. Or in the case of a header showing the graphic served from the images folder. Currently I have resorted to using the full http:// url. Oh and will it be search engine friendly?

    Thanks

    Justin
     
    static1635, Aug 4, 2006 IP
  2. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not quite sure what you mean, but you can use semi-canonical URLs that only have the full path, for example: HREF="/images/button.gif" or HREF="/" (for the homepage). Just miss out the "http://www.yoursite.com" bit. These URLs will always work, regardless of the current directory.

    If this isn't it, can you give some examples to show what you mean?

    Cheers, Cryo.
     
    Cryogenius, Aug 4, 2006 IP
  3. static1635

    static1635 Active Member

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    yes that works thanks, guess I was being pretty dumb :eek:
     
    static1635, Aug 4, 2006 IP