For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > November 2004 > Newbie Relinking old html files to new php files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie Relinking old html files to new php files
Pascal Bouchard

2004-11-29, 4:02 pm

I am new to PHP and learning. On my web site, all my files have the html
extension. In the near future, I want to dynamically generate them by using
PHP. In doing so, for example, my index.html file will become index.php.
This will affect visitors linking to my site using old index.html. Is it
possible to use .htaccess to correct this problem and how is it done?
Thanks.


---
Ce courriel est exempt de virus.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-16


Polaris

2004-11-29, 4:02 pm

There is a very simple workaround for this...
Give index.html the following code:

<html>
<head>
<meta http-equiv="refresh" content="0; url=index.php">
</head>
<body>
</body>
</html>

It will directly go to index.php and you don't have to warn anybody.

Polaris.


"Pascal Bouchard" <forum@mitan.ca> schreef in bericht
news:3pbqd.44025$i_4.2137936@weber.videotron.net...
>I am new to PHP and learning. On my web site, all my files have the html
>extension. In the near future, I want to dynamically generate them by using
>PHP. In doing so, for example, my index.html file will become index.php.
>This will affect visitors linking to my site using old index.html. Is it
>possible to use .htaccess to correct this problem and how is it done?
> Thanks.
>
>
> ---
> Ce courriel est exempt de virus.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-16
>



Pascal Bouchard

2004-11-29, 4:02 pm

Dans un message précédent, Polaris <ask4polaris@hotmail.com> a écrit:
> Give index.html the following code:
>
> <html>
> <head>
> <meta http-equiv="refresh" content="0; url=index.php">
> </head>
> <body>
> </body>
> </html>
>
> It will directly go to index.php and you don't have to warn anybody.
>

Hum... I cannot use that because my index.html will be no more at the root
of my server, having been replaced by index.php.
Will my visitors linking to the (now gone) index.html get a 404 error?
How to avoid that and have the index.php take over?
Thanks!



---
Ce courriel est exempt de virus.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-17


Hilarion

2004-11-29, 4:02 pm

>> Give index.html the following code:
[color=darkred]
> Hum... I cannot use that because my index.html will be no more at the root of my server, having been replaced by index.php.


So create "index.html" file with above code. It'll only redirect
users to "index.php" file.


You may also use mod_rewrite of apache (if you are using one) to change
html extensions to php extensions in URLs.

Hilarion


Pascal Bouchard

2004-11-29, 4:02 pm

Dans un message précédent, Hilarion <hilarion@SPAM.op.SMIECI.pl> a
écrit:

> So create "index.html" file with above code. It'll only redirect
> users to "index.php" file.
>

Understand! This "index.html" file will only contain the redirect code to
"index.php". Fine.

> You may also use mod_rewrite of apache (if you are using one) to
> change html extensions to php extensions in URLs.
>

My Web site is on a apache server.
Another newbie question:
Before using the elegant "index.html" solution above or the extreme
mod_rewrite one, do the apache servers make a difference between .html or
..php extensions i.e. if presented with the request of "index.html", the
server would automatically, by default, send "index.php" if this is the only
file available?

Many thanks again to all!

Pascal.


---
Ce courriel est exempt de virus.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-18


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com