dongqian6484 2016-01-31 19:58
浏览 51
已采纳

将域a的所有请求重定向到域b的相应页面

hello all i have a domain a where my site is and now i have a short domain of my main site b i want to diect all the trafics from domain b to domain a like

www.b.com/xyz.php?id=23 to www.a.com/xyz.php?id=23

and this all by htaccess only right now i am using index page with this code

 header('location:www.domain.com'); 

if you have any idea please let me know any help is appreciated Thankyou

  • 写回答

2条回答 默认 最新

  • dsm17496 2016-01-31 23:06
    关注

    If its going in .htaccess of your doc root, then a simple rewrite should work:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.b\.com$ [NC]
    RewriteRule ^(.*)$ http://www.a.com/$1 [R,L]
    

    This assumes you have the Rewrite module loaded in the main config file:

    LoadModule rewrite_module modules/mod_rewrite.so
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 VB.NET2022如何生成发布成exe文件
  • ¥30 matlab appdesigner私有函数嵌套整合
  • ¥15 给我一个openharmony跑通webrtc实现视频会议的简单demo项目,sdk为12
  • ¥15 vb6.0使用jmail接收smtp邮件并另存附件到D盘
  • ¥30 vb net 使用 sendMessage 如何输入鼠标坐标
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!
  • ¥20 有关esp8266连接阿里云
  • ¥15 C# 调用Bartender打印机打印