你能通过php函数重定向每个现有的html页面吗? [英] can you redirect every existing html page through a php function?

查看:57
本文介绍了你能通过php函数重定向每个现有的html页面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过

a php功能重定向现有网站上的每一页?


换句话说,说我有一个整体功能性HTML网站,从未写过使用任何php的
。现在我希望每个页面都有一个php函数句柄显示

,而不是:

http://www.mysite.com/mypage.html


你会打电话:<

http://www.mysite .com / dopage.php?p = mypage.html


....然后php可以在每个页面的末尾做一些发烧友包括,

等,或添加标题等。


我不想重写整个网站并重命名所有页面;另外,这个

网站已经存在了一段时间,网站周围有很多链接

网站直接网址,所以我想知道是否我可以拦截

到该网站的每个URL并将其重定向到php函数,然后

打开页面。


感谢您对此有任何建议...

-

Stephen Kay

Karma-Lab sk@karma-lab.NOSPAM.com

^^^^^^^

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
^^^^^^^

推荐答案

>有没有办法重定向现有网站上的每一个页面
> Is there a way to redirect every single page on an existing web site
通过一个php函数?

换句话说,我说有一个完整的功能HTML网站,从未写过使用任何php。现在我希望有一个php函数句柄显示每个页面,例如,而不是:

http://www.mysite.com/mypage.html

你会打电话:

< a rel =nofollowhref =http://www.mysite.com/dopage.php?p=mypage.htmltarget =_ blank> http://www.mysite.com/dopage.php?p = mypage.html

...然后php可以在每个
页面的末尾做一些发烧友,
等,或添加标题等等

我不想重写整个网站并重命名所有页面;另外,
这个网站已经存在了一段时间,并且有很多链接在网站周围浮动,以便在网站上引导网址,所以我想知道是否我可以拦截
该站点的每个URL并将其重定向到php函数,然后
然后打开页面。

感谢任何关于这一点的建议...
-
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM .com
^^^^^^^
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
^^^^^^^




你在使用什么服务器?

如果你是使用apache然后你可以使用RewriteRule ...它会完全按照你所追求的



RewriteRule ^([^ /] +)/( [^ /] +)。html



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 =
/dopage.php?p=


1 [L]


然后你可以担心dopage.php实际上做了什么。


Simon

-
http:// u rlkick.com/

免费网址重定向服务。将长URL转换为更短的URL。
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.


这篇关于你能通过php函数重定向每个现有的html页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆