douyuefu1372 2014-02-14 22:57
浏览 49
已采纳

mod重写谜团,重定向到外部网站

I am setting up some mod rewrite redirects for particular URLs; we are launching a new site and need to send a few URLs to the old web site until migration is complete. I have copied the format of another site I did this with, with the exception being that the other site was apache 2.4 and this one is 2.2. Here's my (so far) very minimal .htaccess and the new site, domain.org:

RewriteEngine On

RewriteRule ^services/membership/login/login\.html$ http://oldsite.domain.org/services/membership/login/login.html [L]

I can verify that mod_rewrite is enabled because I can get a log to generate, but I can't make sense of the log. The results of browsing to http://domain.org/services/membership/login/login.html, which is a CMS, is that the domain doesn't change and I get the content of the CMS home page but the css and images aren't loaded. This makes no sense to me. If I got a match on the rule, the redirect should happen and I should get the right result. If I don't get a match I should get a 404 because there is no URL for this.

  • 写回答

1条回答 默认 最新

  • dsm17496 2014-02-14 23:06
    关注

    Simply you are able to use the following in your .htaccess:

    Redirect http://domain.org/services/membership/login/login.html http://oldsite.domain.org/services/membership/login/login.html
    

    Or

    Redirect /services/membership/login/login.html http://oldsite.domain.org/services/membership/login/login.html
    

    For Reference: http://www.htaccessredirect.co.uk

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝