【问题标题】:htaccess redirect get parameterhtaccess 重定向获取参数
【发布时间】:2016-07-29 09:55:23
【问题描述】:

我有一个带有类似链接的旧网站

http://example.com/folder/serve.asp?var=10&var2=55

我需要使用这样的链接将它们重定向到新的typo3版本

http://example.com/index.php?id=5&tx_myplugin_plugin[action]=show&tx_myplugin_plugin[controller]=data&tx_myplugin_plugin[var2]=55

我尝试编辑 .htaccess 并添加

RewriteRule ^folder/serve.asp??var=10&var2=([0-9]+)$ index.php?id=5&tx_myplugin_plugin[action]=show&tx_myplugin_plugin[controller]=data&tx_myplugin_plugin[var2]=$1 [L,NC]

RewriteEngine On 之后

tx_myplugin_plugin[var2] 始终为空。

【问题讨论】:

    标签: apache .htaccess mod-rewrite typo3


    【解决方案1】:

    我想通了

    RewriteCond %{THE_REQUEST} \s/+folder/serve.asp\?var=10&var2=([^\s&]+) [NC]

    重写规则 ^http://example.com/index.php?id=5&tx_myplugin_plugin[action]=show&tx_myplugin_plugin[controller]=data&tx_myplugin_plugin[var2]=%1 [R=302,L]

    【讨论】:

      猜你喜欢
      • 2017-09-20
      • 2020-04-13
      • 2015-04-27
      • 2019-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-05
      • 2016-12-18
      相关资源
      最近更新 更多