Re: Renaming all pages to .php

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

 



Hi David

Comments inline...

On Thu,Jun 19, 2003 at 08:31:40PM -0700, David Blomstrom wrote : 
> At 09:16 PM 6/19/2003 -0500, Joshua Stein wrote:
> 

<snip>
> I don't know exactly what you mean, but I just renamed one of my pages 
> (using Dreamweaver) with a .php extension, previewed it in Mozilla, and it 
> worked fine. This is the address displayed in the browser:
> 
> file:///C:/sites/geosymbols/birds.php
> 
> However, when I pasted the URL into Internet Explorer. So I linked to the 
> page from page X, previewed page X in IE and clicked the link and was taken 
> to C:\sites\geosymbols\waldman.php
> 
> That's weird. I never even realized my two browsers displayed "localhost" 
> links differently - "file:///c" versus "C:," and forward slashes versus 
> back slashes.
> 
> But I assume that means my server is set up properly. As long as I can 
> preview my pages, I can't complain!
> 
> * * * * * * * * * *
> 
</snip>

This doesn't mean your server is set up correctly.  The file:// scheme
or the c:\... means that the browser is reading the file directly from
the hard disk.  The page is not being served by your web server (which I
assume you have setup on your local machine).  When the browser reads a
file from the hard drive, it will display the contents (if it can), 
parsing out and rendering HTML as it goes.

For example, create a file with a php extension with the following
contents:-

<?php
phpinfo();
?>
<H1>This bit is html</H1>

Save this in your webroot.  Here we have a page that has both html 
and php in it.  If you view this using the file:// or c:\ methods 
(as used by dreamweaver's preview by default) you will see the H1 
rendered and none of the php code, but the php code will not have 
executed.  Compare that with browsing via http://localhost/mytest.php.
You'll find that the php has executed and you have the html rendered out
below.

When testing pages locally the best way to do it is to have a browser
open and explicitly browse to http://localhost/<dirname>/<pagename>.php

</snip>
> Alright, it sounds like a go. Thanks for all the tips.
<snip>

I think you'll find that having every page in a separate folder will
create an internal link nightmare.  I would be inclined to structure
your site in a more standard way and use Apache's rewrite module
to create the http://site.com/dirname/ style urls you are talking about.
You could also use the rewrite module to allow people to request a page
with an htm extension, which is translated into, eg: a page with a php
extension, a query string passed to a specfic php page, etc.  That way
you keep search engines and bookmarkers happy but retain your
development freedom.  It effectively inserts a configurable layer between 
the browser and the server where you can manage the type and appearance
of urls that apply to the site.

ISAPI url rewrite filters are available for IIS if that's your server 
flavour.

Hope this helps.

Ronan

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux