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

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

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法