htaccess从url重定向特定网址得到参数

时间:2017-06-27 07:04:25

标签: apache .htaccess

你好我有这个链接:

exemple.com/imageget.php?width=351&height=245&image=http://pic.exemple.com/images/marganit/266.jpg

中的参数“image”
exemple.com/imageget.php

是动态的,我需要像这样提取这个参数:

http://pic.exemple.com/images/marganit/266.jpg

将页面重定向到

http://pic.exemple.com/marganit/266.jpg

有人能帮助我吗?谢谢!

1 个答案:

答案 0 :(得分:1)

尝试以下,

RewriteEngine On
RewriteCond %{QUERY_STRING} ^width=\d+&height=\d+&image=(.*)(/images)(.*)
RewriteRule ^ %1%3? [R=301]

测试here