【问题标题】:.htaccess rewrite from index.cgi?action= to / or index.php.htaccess 从 index.cgi?action= 重写为 / 或 index.php
【发布时间】:2012-06-09 13:01:27
【问题描述】:

我们从论坛提供商转移到了我们自己的论坛和托管。 旧版论坛使用 index.cgi?action= 有时它是 index.cgi?action=viewprofile&user=USERNAME 等等……

我想将任何 index.cgi?action= 请求重定向到 http://www.example.com/ 或 index.php

我还想重定向:speller/spellchecker.html 到 http://www.example.com/ 或 index.php

全部重定向,我想做301。

谁能帮忙?

谢谢

【问题讨论】:

  • 您要将index.cgi?action=viewprofile 重定向到index.php?action=viewprofile 还是仅仅重定向到index.php
  • 只需 index.php 或重定向到 example.com

标签: apache .htaccess mod-rewrite redirect rewrite


【解决方案1】:

我希望这对你有用:

RewriteEngine on
RewriteBase /

RewriteCond %{QUERY_STRING} action
RewriteRule index\.cgi http://www.example.com [L,R=301]

RewriteRule speller/spellchecker.html http://www.example.com [L,R=301]

对 index.cgi 的每个包含 action 的请求都将被重定向,对 speller/spellchecker.html 的每个请求也将被重定向。

【讨论】:

  • 谢谢,明天早上试试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-04
相关资源
最近更新 更多