-1

I'm trying to figure out a mod_rewrite rule to redirect from the following URL:

/archives/collections/archon/index.php?p=collections/controlcard&id=450

to this:

/archives/collections/archon/index.php?p=collections/findingaid&id=450

The id parameter would not be static.

Thanks for any help.

Current contents of .htaccess:

RewriteEngine On
Options +FollowSymlinks
RewriteCond %{QUERY_STRING} ^p=collections/controlcard&id=([0-9]+)$
RewriteRule ^index.php$ index.php?p=collections/controlcard&id=%1 [R=301,L]
4

2 回答 2

0

使用%{QUERY_STRING}你可以这样做:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /archives/collections/archon/

RewriteCond %{QUERY_STRING} ^p=collections/controlcard&id=([0-9]+)$
RewriteRule ^index.php$ index.php?p=collections/findingaid&id=%1 [R=301,NC,L]
于 2013-09-05T13:59:40.253 回答
0

在您的文件中尝试以下代码archon/.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /archon/

RewriteCond %{QUERY_STRING} ^p=collections/controlcard(&.*|)$ [NC]
RewriteRule ^(index\.php|)$ $1?p=collections/findingaid%1 [R=301,L,NC]
于 2013-09-05T14:42:52.420 回答