Re: File extensions



On 26 Feb, 23:50, "Thad" <tsob...@xxxxxxx> wrote:
"Stuart Millington" <n...@xxxxxxxxxx> wrote in message

news:l1s6u29qi1ufpkcrpn9s2369r8smgvu0nl@xxxxxxxxxx

On Mon, 26 Feb 2007 16:34:47 -0700, "Thad" <tsob...@xxxxxxx> wrote:

file end in .php. So, I renamed test1.html to test1.php and it worked.
Is
that the case everywhere or could it just be my server?

No, it depends on the server set-up. The server can be configured to
run PHP within .html files, or mod_rewrite could be used, but it is
non-standard. Unless you have a particular reason why you can't use
.php file extensions, it should not be a problem.

So it looks like my server does mod_rewrite. It's just this is the first
time I had run into this.

Thanks so much Stuart.
Much appreciated,
Thad

your server is set up to execute the php inside the files if they end
in .php which is normal. Stuart meant that if you have control over
the server you could change this to say only .pjio files or
a .phtml, .php and .php5 all at once etc.. whatever you choose,
or if you have access to the way apache works, (you probably do
via .htaccess files) you could rewrite (that is redirect) the URL that
your visitor has asked for, say script.html to script.php, but not let
the user know you have done it (a so called internal rewrite)

RewriteRule script.html script.php [L]

this would meant that while the file extension could remain .html, the
server is actually "forwarding" on the request to a file that ended
in .php which would be the script that would actually be doing the
work, whereas script.html would just be a fake, even a non existent
file that your user would see.
This is sometimes used in conjunction with other methods to hide the
server technology behind the dynamic pages, making it harder to
profile before an attack (since you could be using .NET jps and other
technologies apart from php)

Hope that clears it up a bit.

.



Relevant Pages

  • Re: PHP Instalation problems. Browser doesnt know what to do
    ... This is loaded and run as a local server (for class ... PHP 5.2.0 from php-5.2.0-win32-installer.msi ... # configuration directives that give the server its instructions. ...
    (comp.lang.php)
  • Re: PHP Instalation problems. Browser doesnt know what to do
    ... This is loaded and run as a local server (for class ... PHP 5.2.0 from php-5.2.0-win32-installer.msi ... # configuration directives that give the server its instructions. ...
    (comp.lang.php)
  • Re: redirect / new website how to redirect old (google) links to new site ?
    ... But why use PHP for some other function such as processing form data. ... to process *all* .html files as php files is an unnecessary overhead. ... That's what a server is for. ... You only need an extension if you directly map a URL onto the server's ...
    (comp.lang.php)
  • Re: write with cURL
    ... execute permissions. ... This is assuming that the PHP script runs ... of potential security risks from other users on the same server. ... Apache as the global web server user and thus needs world write ...
    (alt.php)
  • mysqli error?
    ... I'm just setting up my php enviroment and I typed in a simple script ... # configuration directives that give the server its instructions. ...
    (comp.lang.php)