【发布时间】:2011-01-09 04:25:04
【问题描述】:
我正在尝试在我的 .htaccess 中使用重写规则将用户从旧链接带到临时的新链接(它不是永久的新网站,所以我不想要 301 重定向)
以下适用于所有 html 页面以及不带参数的 php 页面,但它不处理最后一个示例 - 带参数的 php 页面。注意新域上的目录结构不同,但是url的参数是完全一样的。我可以用正则表达式做些什么来重写吗?我没有太多编写自己的 reg 表达式的经验,所以我不确定从哪里开始。谢谢!
我的 .htaccess 文件:
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Options -MultiViews
Options +FollowSymlinks
RewriteEngine on
RewriteRule invest/index.html http://example.org/new_file_structure/invest/index.html
RewriteRule index-old.html http://example.org/index.php
RewriteRule invest/i2/ap/row_I2_i_ap1.php http://example.org/new_file_structure/i2/ap/row_I2_i_ap1.php
##The following doesn't work:
RewriteRule subpages/view.php?d=i1_014 http://example.org/2010/view.php?d=i1_014
谢谢, 仁
【问题讨论】:
标签: php .htaccess mod-rewrite