我正在尝试找出一个mod_rewrite规则,以便从以下网址重定向:
/archives/collections/archon/index.php?p=collections/controlcard&id=450
到此:
/archives/collections/archon/index.php?p=collections/findingaid&id=450
id参数不是静态的。
感谢您的帮助。
.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]
答案 0 :(得分: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]
答案 1 :(得分: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]