【发布时间】: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]