htaccess重定向与querystring [英] htaccess redirection with querystring

查看:73
本文介绍了htaccess重定向与querystring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重定向以下网址 http://test.com/changefile.php?filename=top-ranked-colleges

How can I redirect the following url http://test.com/changefile.php?filename=top-ranked-colleges

http://test.com/top-ranked-colleges.php 使用htaccess重定向.

http://test.com/top-ranked-colleges.php using htaccess redirection.

任何人都可以帮助我.预先感谢.

Anybody please help me. Thanks in advance.

推荐答案

尝试一下

RewriteCond %{QUERY_STRING} ^filename=(.*)$
RewriteRule .* http://test.com/%1.php? [R=301,L]

http://test.com/changefile.php?filename=top-ranked-colleges更改为http://test.com/top-ranked-colleges.php

RewriteCond %{REQUEST_URI} ^/(.*).php$
RewriteRule .* http://test.com/changefile.php?filename=$1 [L]

http://test.com/top-ranked-colleges.php更改为http://test.com/changefile.php?filename=top-ranked-colleges

这篇关于htaccess重定向与querystring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆