开发者

Server Redirect from example.html to script.php?url=example

I 开发者_Python百科have a really convoluted website that I need to work on. I was thinking on creating a single "home" php file that includes the main stuff (menu, sidenav, head, etc) and inserting the content for every page. I already have the content from all the pages separated so I have a duplicate of the site where all the html files have only the inner content ( i mean no , no menues, nothing except for the content). I would like to know if there is a way to redirect from any link that looks like www.site.com/example.html to www.site.com/script.php?url=example . That way, I can use the variable to insert the content files, or is there any other way to do such a thing?


Don't do that. That is bad practice in terms of security. Bad guys can specify urls such as:

www.site.com/script.php?url=../../../etc
www.site.com/script.php?url=www.hackers.com
www.site.com/script.php?url=www.xxx.com

You must have a look at:

  • PHP Security Guide
  • Top 7 PHP Security Blunders


Already find a solution...

(.*) http://www.example.com/script.php?$1

where $1 is the variable c

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜