Help - Search - Member List - Calendar
Full Version: Odd Directory Problem with PHP
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
AF
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

Stefan Rybacki
AF wrote:
QUOTE
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

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

http://www.domain.com/webpage.php?variable...o&variable2=bar

QUOTE

Best regards,

Regards
Stefan

QUOTE

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


AF
On Fri, 24 Jun 2005 17:53:50 +0200, Stefan Rybacki
<[Email Removed]> wrote:

snip
QUOTE

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

http://www.domain.com/webpage.php?variable...o&variable2=bar


Best regards,

Regards
Stefan

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

Tony
Stefan Rybacki wrote:
QUOTE
AF wrote:
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

It seems your configuration is weird. Normally it should look like
this:
http://www.domain.com/webpage.php?variable...o&variable2=bar

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
[Email Removed]

Stefan Rybacki
Tony wrote:
QUOTE
Stefan Rybacki wrote:

AF wrote:

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

It seems your configuration is weird. Normally it should look like
this:
http://www.domain.com/webpage.php?variable...o&variable2=bar


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 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.

QUOTE

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


Stefan Rybacki
AF wrote:
QUOTE
On Fri, 24 Jun 2005 17:53:50 +0200, Stefan Rybacki
<[Email Removed]> wrote:

snip

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

http://www.domain.com/webpage.php?variable...o&variable2=bar


Best regards,

Regards
Stefan


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.


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


QUOTE
Best regards,

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


Tony
Tony wrote:

QUOTE
Stefan Rybacki wrote:

AF wrote:

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

It seems your configuration is weird. Normally it should look like
this:
http://www.domain.com/webpage.php?variable...o&variable2=bar


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,

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.

Exyle
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:
QUOTE
AF wrote:

On Fri, 24 Jun 2005 17:53:50 +0200, Stefan Rybacki
<[Email Removed]> wrote:

snip

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

http://www.domain.com/webpage.php?variable...o&variable2=bar


Best regards,


Regards
Stefan


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.


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


Best regards,

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


bonfils
"Tony" <[Email Removed]> wrote:

QUOTE
Tony wrote:

Stefan Rybacki wrote:

AF wrote:

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

It seems your configuration is weird. Normally it should look like
this:
http://www.domain.com/webpage.php?variable...o&variable2=bar


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,

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.

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


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.