By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,830 Members | 2,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,830 IT Pros & Developers. It's quick & easy.

OK really stupid question now.

P: n/a
Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec
Aug 22 '08 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Michael thanks for the reply...

So I should stick to standard php then... Thats suits me :-)

By the way, what advantage can be gained by using this other
method???

Cheers

Alec
Aug 22 '08 #2

P: n/a
On Fri, 22 Aug 2008 08:11:35 -0700, Alec wrote:
Michael thanks for the reply...

So I should stick to standard php then... Thats suits me :-)
Google "clean urls" if you want more control over what's in the address
bar.
By the way, what advantage can be gained by using this other method???
The only advantage is facilitating laziness. You can set up a webserver to
process any file extension through any server-side process but that means
all files are being run through the processor instead of just the files
that have scripting language in them. It's drastically increasing server
load unnecessarily.

--
I told you this was going to happen.

Aug 22 '08 #3

P: n/a
..oO(Michael Vilain)
>In article
<3c**********************************@k13g2000hse .googlegroups.com>,
Alec <aj****@aol.comwrote:
>Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec

It's a very painful modification and expensive (to performance) of their
web server to always process html files as dynamic pages.
That's a wrong assumption, since you don't know anything about their
server. If for example PHP is used on every page (which it usually is
on every bigger site), then there's nothing wrong with this approach.
Additionally you don't know how the server maps the URLs to the actual
files or scripts. The .html could be there just for cosmetic reasons,
while still allowing for /foo.html being served directly and /bar.html
processed by PHP. Quite easy to do on Apache servers.
>Instead of
interpeting the pages as plain old "ship it to the remote browser and
don't do anything else" HTML code they modified their web server to
always invoke the php or perl parser.
Could be, but you would have to ask them if that's indeed the case. You
can't tell that from just looking at the URLs.
>It can be done, but it's a Massively Bad Idea(tm) to bork on your web
server that way.
As said - it depends.
>If they have the processing capacity, great. But I'll
bet if they handle high-volume throughput, they'll soon discover that
stupid is a stupid does.
I doubt that.

Micha
Aug 22 '08 #4

P: n/a
..oO(Alec)
>Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??
A URL and a file on disk are two completely different things. In fact a
URL is just a string, things like 'directory' or 'file extension' don't
have any meaning there. The .html above is just a 5-char string without
any meaning.

It depends on the server how to map those URLs onto the files or scripts
on the disk. Usually this mapping is done directly from the URL to the
file system, but there are also various ways for URL rewriting. There
doesn't even have to be a file called "Alfa Romeo_news.html", it could
all be just a single script for example. From just looking at a URL you
can't tell anything about what's going on behind the scenes or how the
pages are created. It can even happen all at the same time, e.g.

http://example.com/foo.html -static page
http://example.com/bar.html -PHP script
http://example.com/abc.html -SSI page
http://example.com/xyz.html -a JPEG image

Micha
Aug 22 '08 #5

P: n/a
Alec wrote:
Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec
A simple remapping in .htaccess will do it. Or there could be an SSI
include in the .html file for the .php file. Or other ways.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 22 '08 #6

P: n/a
Jerry Stuckle wrote:
Alec wrote:
>Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec

A simple remapping in .htaccess will do it. Or there could be an SSI
include in the .html file for the .php file. Or other ways.
As Jerry said you can tell the server to process a page with the PHP
Engine using any extension you want.

for example in your .htaccess file: (apache)
AddType application/x-httpd-php .htm .html

will process .htm, html to the PHP engine.

AddType application/x-httpd-php .foo

will allow pages with .foo extensions the same.

One thought for this is to hide the php extension to throw off some
hackers, not sure how effective it is, but I suppose every little bit
helps, especially if they are scanning for php extension automatically.
Aug 22 '08 #7

P: n/a
FutureShock wrote:
Jerry Stuckle wrote:
>Alec wrote:
>>Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec

A simple remapping in .htaccess will do it. Or there could be an SSI
include in the .html file for the .php file. Or other ways.
As Jerry said you can tell the server to process a page with the PHP
Engine using any extension you want.

for example in your .htaccess file: (apache)
AddType application/x-httpd-php .htm .html

will process .htm, html to the PHP engine.

AddType application/x-httpd-php .foo

will allow pages with .foo extensions the same.

One thought for this is to hide the php extension to throw off some
hackers, not sure how effective it is, but I suppose every little bit
helps, especially if they are scanning for php extension automatically.
Even easier - just rewrite all applicable .html extensions to .php ones.
No need to parse .html files for php code that way.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 23 '08 #8

P: n/a
FutureShock wrote:
Jerry Stuckle wrote:
>Alec wrote:
>>Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec

A simple remapping in .htaccess will do it. Or there could be an SSI
include in the .html file for the .php file. Or other ways.
As Jerry said you can tell the server to process a page with the PHP
Engine using any extension you want.

for example in your .htaccess file: (apache)
AddType application/x-httpd-php .htm .html

will process .htm, html to the PHP engine.

AddType application/x-httpd-php .foo

will allow pages with .foo extensions the same.

One thought for this is to hide the php extension to throw off some
hackers, not sure how effective it is, but I suppose every little bit
helps, especially if they are scanning for php extension automatically.
It won't help. You also need to disable the advertising of php in the
php.ini file, for instance. But most servers have php installed anyway,
so hackers will check for it.

But if you follow good security practices in your code and server
configuration, it shouldn't be a problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 23 '08 #9

P: n/a
Jerry Stuckle wrote:
FutureShock wrote:
>Jerry Stuckle wrote:
>>Alec wrote:
Sorry guys, stupid question....

Am no programming expert and have only just started using php for
creating dynamic news pages.

Then I see a dynamic website without the php extension.

http://www.newcarnet.com/Alfa%20Romeo_news.html?id=8380

It has the html extension that loads the required page dynamically.

I thought html pages could not be dynamic. How is this done??

Thanks

Alec
A simple remapping in .htaccess will do it. Or there could be an SSI
include in the .html file for the .php file. Or other ways.
As Jerry said you can tell the server to process a page with the PHP
Engine using any extension you want.

for example in your .htaccess file: (apache)
AddType application/x-httpd-php .htm .html

will process .htm, html to the PHP engine.

AddType application/x-httpd-php .foo

will allow pages with .foo extensions the same.

One thought for this is to hide the php extension to throw off some
hackers, not sure how effective it is, but I suppose every little bit
helps, especially if they are scanning for php extension automatically.

It won't help. You also need to disable the advertising of php in the
php.ini file, for instance. But most servers have php installed anyway,
so hackers will check for it.

But if you follow good security practices in your code and server
configuration, it shouldn't be a problem.
That is why stated as to how effective it was. I am not questioning the
validity of it, just how simple it would be if you so choose to alter
the extension. The statement about why it would be done, I had read off
a site. Probably a well know site.
http://www.php.net/manual/en/security.hiding.php
I personally use the php extension.

Scotty
Aug 23 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.