You are here: Re: can you redirect every existing html page through a php function? « PHP Programming Language « IT news, forums, messages
Re: can you redirect every existing html page through a php function?

Posted by Simon on 10/08/06 11:43

> Is there a way to redirect every single page on an existing web site
> through
> a php function?
>
> In other words, say I have a whole functional HTML web site, never written
> to use any php. Now I would like to have a php function handle displaying
> every page, for example, instead of:
>
> http://www.mysite.com/mypage.html
>
> you would call:
>
> http://www.mysite.com/dopage.php?p=mypage.html
>
> ...and then the php could do some fancier includes at the end of each
> page,
> etc., or add a header, etc.
>
> I don't want to rewrite the whole site and rename all the pages; also,
> this
> site has been around for awhile and there are a lot of links floating
> around
> the internet to direct urls on the site, so I'm wondering if I can
> intercept
> every URL to that site and redirect it to the php function, which will
> then
> open the page.
>
> Thanks for any advice on this...
> --
> Stephen Kay
> Karma-Lab sk@karma-lab.NOSPAM.com
> ^^^^^^^

What server are you using?
If you are using apache then you can use RewriteRule ... It will do exactly
what you are after.

RewriteRule ^([^/]+)/([^/]+).html$ /dopage.php?p=$1 [L]

Then you can worry about what dopage.php actually does.

Simon
--
http://urlkick.com/
Free URL redirection service. Turns a long URL into a much shorter one.

 

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

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