Re: Apache odd behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 16, 2009 at 08:34:22PM +0000, Stuart wrote:

<snip>

> This is your problem, you're not understanding where the paths are
> being resolved. Apache has absolutely no involvement in resolving
> relative paths in your HTML files to absolute URLs. The browser does
> this. All you need to do is use absolute URLs and everything will work
> fine. By absolute, in case you don't know, I mean starting with a /
> and being "from" the document root in the web server.

FWIW, I've been doing computers since before the CP/M days
(pre-pre-DOS), so I do know the difference between absolute and relative
paths.

I'm a little doubtful about the browser specifying things like the URLs
for links within a HTML page. However, this would explain why there are
separate entries for image fetches in the Apache logs, occurring after
the main page has been requested. Do you have some reference for this?
I'd like to read more about the server-client interaction in depth.

> For example, if you have a tag like <a href="arse.php">arse</a> and
> arse.php is in the same directory as index.php you need to change it
> to <a href="/arse.php">arse</a>.
> 
> Another example... if you have <a href="somedir/crack.php">crack</a>
> where crack.php is in the subdirectory somedir beneath where index.php
> is you need to change the tag to <a
> href="/somedir/crack.php">crack</a>.
> 
> You need to apply this to all URLs in your code, including
> stylesheets, images and javascript references. This should not be a
> difficult concept to grasp, so maybe I'm not explaining it right. If
> so please explain what you understand by what I'm saying and I can
> alter it to be more helpful.

Here's the issue I have with this: normally I build pages on the fly
with PHP. However, on this particular project, my wife is building the
pages in Dreamweaver. And, as I mentioned before, while in development,
the pages reside on an internal server, like this:

http://pokey/example.com

That is, pokey is an internal Debian machine where all our client sites
reside as backups in the /var/www directory. So as far as pokey is
concerned, the pages are at:

/var/www/example.com

but we see it as:

http://pokey/example.com

Dreamweaver has a very brain dead way of handling templates, resultant
pages, and the internal page links. And while my wife is very savvy,
her Windows-weenie-Dreamweaver way of handling links is to click on a
button which opens a dialog box, in which she finds the image, and
clicks "Okay".

This is all fine while the pages are on the development server. (Well,
not really, since Dreamweaver regularly hacks up image links in
non-intuitive ways.) But when they get uploaded to the production server
on the internet, all those absolute links have to change from:

http://pokey/example.com/graphics/myportrait.gif

or

/example.com/graphics/myportrait.gif

to

http://example.com/graphics/myportrait.gif

or

/graphics/myportrait.gif

Moreover, I'm not even sure she can specify the links absolutely when
doing her "Click and Search" routine. She'd probably have to manually
type them in, unless there's some setting in Dreamweaver I don't know
about.

In any case, changing absolute links in development pages to absolute
links in production pages would involve a heap of (dangerous) global
search-and-replace magic.

So specifying absolute links might be a bit much. I'm not happy with the
way DW handles this stuff, but I have to strike a balance between my
vim-handcoding-command-line method and my wife's
click-and-drag-gotta-be-GUI method.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux