Professional Web Applications Themes

Odd Directory Problem with PHP - PHP Development

I am a novice to PHP, so please forgive any dumb questions, etc. I finally learned how to pass variable with php, or at least learned one way. My urls look like this http://www.domain.com/webpage.php/variable1/variable2 In the above example, my web page which holds the php code is obviously wegpage.php. My php code returns to me the value of variable1 and variable2, and subsequent php code works great. Except for one odd thing: all of my relative urls are no longer working properly. For example, if I were to create a web page using FrontPage, or NetObjects Fusion, or even by ...

  1. #1

    Default Odd Directory Problem with PHP

    I am a novice to PHP, so please forgive any dumb questions, etc.

    I finally learned how to pass variable with php, or at least learned
    one way.

    My urls look like this

    http://www.domain.com/webpage.php/variable1/variable2

    In the above example, my web page which holds the php code is
    obviously wegpage.php.

    My php code returns to me the value of variable1 and variable2, and
    subsequent php code works great.

    Except for one odd thing: all of my relative urls are no longer
    working properly.

    For example, if I were to create a web page using FrontPage, or
    NetObjects Fusion, or even by hand, I can use relative directories.
    (I hope that is the correct name for them.) I then store my images in
    a directory called "/images", and if my normal html code looks like
    this

    IMG SRC="/image/Florida-Small1.gif"

    And I will see the image on a web page. Same goes for href's,
    background images, etc.

    But when I use the same web page with the php add, all of the relative
    urls are messed up and the only way I can use a url in my code is to
    add the full path, i.e. type this code

    IMG SRC="http://www.domain.com/image/Florida-Small1.gif"

    Is there a work around or a php function I am missing here that would
    solve my problem?

    Or to state it another way, I would like to take html code generated
    from FrontPage or NetObjects, add the php code I need for value
    passing and not have to edit the html code for the relative path.

    By the way I have seen some java code that would solve the problem,
    but I am trying to stay away from java code.


    Best regards,

    Al
    http://www.affordablefloridainsurance.com
    http://www.americanbestmortgages.com
    AF Guest

  2. #2

    Default Re: Odd Directory Problem with PHP

    AF wrote: 

    It seems your configuration is weird. Normally it should look like this:

    http://www.domain.com/webpage.php?variable1=foo&variable2=bar
     

    Regards
    Stefan
     
    Stefan Guest

  3. #3

    Default Re: Odd Directory Problem with PHP

    On Fri, 24 Jun 2005 17:53:50 +0200, Stefan Rybacki
    <net> wrote:

    snip 
    >
    >Regards
    >Stefan
    >[/ref]
    snip

    I thought the ? was a big no-no with Google. Thus I looked all over
    the net for a different way to pass variables. I discovered the
    method I show in my url of using the / and parsing the referring url.

    Is the ? now acceptable or at least ignored by Google?

    Thanks for your reply, by the way.

    Best regards,

    Al
    http://www.affordablefloridainsurance.com
    http://www.americanbestmortgages.com
    AF Guest

  4. #4

    Default Re: Odd Directory Problem with PHP

    Stefan Rybacki wrote: 
    >
    > It seems your configuration is weird. Normally it should look like
    > this:
    > http://www.domain.com/webpage.php?variable1=foo&variable2=bar[/ref]

    I've seen that sort of setup before, and I was under the impression it was
    intentional. The way I saw it used was on a site that used a "container"
    script that called a "content" script depending on the page name passed - so
    to get www.domain.com/index.php?page=home you would enter
    www.domain.com/home

    I figured that was a server setting that did that - and as I said, it seemed
    intentional...

    --
    Tony Garcia
    Web Right! Development
    SPAM.com


    Tony Guest

  5. #5

    Default Re: Odd Directory Problem with PHP

    Tony wrote: 
    >>
    >>It seems your configuration is weird. Normally it should look like
    >>this:
    >>http://www.domain.com/webpage.php?variable1=foo&variable2=bar[/ref]
    >
    >
    > I've seen that sort of setup before, and I was under the impression it was
    > intentional. The way I saw it used was on a site that used a "container"
    > script that called a "content" script depending on the page name passed - so
    > to get www.domain.com/index.php?page=home you would enter
    > www.domain.com/home[/ref]

    I know A9 does the same but personal I don't like it that way, since you
    get a lot of problems like the OP got.
     
    Stefan Guest

  6. #6

    Default Re: Odd Directory Problem with PHP

    AF wrote: 
    >>
    >>Regards
    >>Stefan
    >>[/ref]
    >
    > snip
    >
    > I thought the ? was a big no-no with Google. Thus I looked all over
    > the net for a different way to pass variables. I discovered the
    > method I show in my url of using the / and parsing the referring url.
    >
    > Is the ? now acceptable or at least ignored by Google?
    >
    > Thanks for your reply, by the way.
    >[/ref]

    If you want to leave it that way you should find a way in your script to
    determine whether variables or a directory/file is given. In first case
    you leave it the way it is. In second case you have to give back the
    requested directory or file, whatever.

    Regards
    Stefan

     
    Stefan Guest

  7. #7

    Default Re: Odd Directory Problem with PHP

    Tony wrote:
     
    >>
    >>It seems your configuration is weird. Normally it should look like
    >>this:
    >>http://www.domain.com/webpage.php?variable1=foo&variable2=bar[/ref]
    >
    >
    > I've seen that sort of setup before, and I was under the impression it was
    > intentional. The way I saw it used was on a site that used a "container"
    > script that called a "content" script depending on the page name passed - so
    > to get www.domain.com/index.php?page=home you would enter
    > www.domain.com/home
    >
    > I figured that was a server setting that did that - and as I said, it seemed
    > intentional...
    >[/ref]


    Tony,

    It's mod rewrite:
    http://httpd.apache.org/docs/mod/mod_rewrite.html


    AF,

    You should use absolute url's for all links, images, css files etc when
    using mod rewrite.







    Tony Guest

  8. #8

    Default Re: Odd Directory Problem with PHP

    Why don't you actually go search google a bit? It reads and indexes
    pages that use the ? perfectly fine. It's google, common, did you
    honestly think they'ed be 5 years out of date?

    Stefan Rybacki wrote: 
    >>
    >> snip
    >>
    >> I thought the ? was a big no-no with Google. Thus I looked all over
    >> the net for a different way to pass variables. I discovered the
    >> method I show in my url of using the / and parsing the referring url.
    >>
    >> Is the ? now acceptable or at least ignored by Google?
    >>
    >> Thanks for your reply, by the way.
    >>[/ref]
    >
    > If you want to leave it that way you should find a way in your script to
    > determine whether variables or a directory/file is given. In first case
    > you leave it the way it is. In second case you have to give back the
    > requested directory or file, whatever.
    >
    > Regards
    > Stefan
    >
    > [/ref]
    Exyle Guest

  9. #9

    Default Re: Odd Directory Problem with PHP

    "Tony" <net> wrote:
     
    >>
    >>
    >> I've seen that sort of setup before, and I was under the impression it
    >> was intentional. The way I saw it used was on a site that used a
    >> "container" script that called a "content" script depending on the page
    >> name passed - so to get www.domain.com/index.php?page=home you would
    >> enter www.domain.com/home
    >>
    >> I figured that was a server setting that did that - and as I said, it
    >> seemed intentional...
    >>[/ref]
    >
    >
    > Tony,
    >
    > It's mod rewrite:
    > http://httpd.apache.org/docs/mod/mod_rewrite.html
    >
    >
    > AF,
    >
    > You should use absolute url's for all links, images, css files etc when
    > using mod rewrite.[/ref]

    Either that or add special rules for them.
    The first time I did this I overlooked the fact that mod rewrite interprets
    not only the URL of your page, but the URLs of all elements in it.
    Check your mod rewrite rules and see whether they evaluate image paths
    correctly?

    --
    bonfils
    http://kim.bonfils.com


    bonfils Guest

Similar Threads

  1. Virtual Directory Problem
    By Mallik in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: October 10th, 01:24 PM
  2. Obsucre Active Directory Problem
    By Peter Ranson in forum Windows Server
    Replies: 0
    Last Post: June 10th, 09:25 AM
  3. directory access problem
    By stegger in forum PERL Miscellaneous
    Replies: 2
    Last Post: June 30th, 05:18 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139