【问题标题】:Apache redirect fool .aspxApache重定向傻瓜.aspx
【发布时间】:2012-08-28 19:38:51
【问题描述】:

我有一个在 Linux 中运行的 apache 服务器,我想知道如何重定向 url?我想通过 apache 来做到这一点,而不是通过添加标题或重定向到单个文件中。目标是避免处理 .aspx

示例 1:

VISITING: wwww.myserver.com/file1.aspx
Will take you to: www/myserver.com/file2.php

示例2:

VISITING: www.myserver.com/file1.aspx?command1=set&command2=set
Will take you to: www.myserver.com/file2.php?command1=set&command2=set

【问题讨论】:

  • 好的,但该链接使用.htaccess 并启用mod_rewrite。你为什么在 linux 上使用 apache 并且有 .aspx 文件?
  • 我不想使用 .aspx。我想将请求从 .aspx 页面重定向到 php 页面,同时保留所有 $_GET 数据
  • 您是否已经启用了 mod_rewrite Apache 模块?
  • 是的,我相信我已经按照以下示例中概述的示例进行了工作:stackoverflow.com/questions/1295148/apache-redirect 只需要使用 RewriteRule ^file1.aspx file2.php [L ,R=301]

标签: linux apache


【解决方案1】:

不使用 mod_rewrite,您可以在 vhost/server 配置或 htaccess 文件中简单地使用 mod_alias:

Redirect 301 /file1.aspx /file2.php

【讨论】:

  • 很好的方法!我已经将我的一些网站从 ASP.NET 转换为 PHP。这为我节省了很多时间!谢谢!
猜你喜欢
  • 1970-01-01
  • 2011-10-12
  • 2010-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-18
  • 2012-06-22
  • 1970-01-01
相关资源
最近更新 更多