dprxj1995 2011-01-30 20:53
浏览 57
已采纳

php中的全局重定向从something.com到www.something.com

I'm a .net developer and I've just started developing a site on PHP running on IIS7-fastcgi.

I was wondering if there is any way to write a global function to automatically redirect any request that comes to my site in the format

http://something.com/anypage.php 
to
http://www.something.com/anypage.php

You can do this in ASP.NET on the global.asax file. IS there any way to do this or set this condition in php?

  • 写回答

4条回答 默认 最新

  • douge3830 2011-01-30 20:55
    关注

    I don't think so..but you can do this using .htaccess

    (edited to include comment below):

    or the iis7 equivalent I guess is what you want http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错