You are here: Re: Convert PHP addresses to HTML « PHP Programming Language « IT news, forums, messages
Re: Convert PHP addresses to HTML

Posted by Philip Ronan on 10/14/05 16:50

"IWT" wrote:

> Ive heard about some sort of script or program that converts a web
> address with a php extension to that with a html. E.g. say if you had
> www.abc.com/123.php the user would be able to access this via
> www.abc.com/123.html.
> We're creating a new site in php and dont want to effect our search
> engine rankings by getting rid of all our existing html pages.

Are you on an Apache server? If so, try putting this in your .htaccess file:

RewriteEngine on
RewriteRule ^(.*)\.html$ $1 [C,E=dothtml:true]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1]
RewriteCond %{ENV:dothtml} ^true$
RewriteRule ^(.*)$ $1.html

If your server receives a request for "/path/to/foo.html", it will first
check to see if a file "/path/to/foo.php" exists. If so, it serves up the
PHP file, otherwise the HTML file gets sent out.

If you're not on an Apache server, then you might be stuck. Ask your hosting
company what your options are.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация