htaccess将Apache RewriteRule .asp转换为.php [英] htaccess Apache RewriteRule .asp to .php

查看:195
本文介绍了htaccess将Apache RewriteRule .asp转换为.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用htaccess中的RewriteRule来永久重定向此内容:

I am trying to use RewriteRule in htaccess to permanently redirect this:

http://www.example.com/store/scripts/prodView.asp?idproduct = 240

http://www.example. com/index.php?route = product/product& path = 59& product_id = 50

我尝试过:

选项+关注符号链接

Options +FollowSymlinks

RewriteEngine开启

RewriteEngine On

RewriteCond%{QUERY_STRING} ^ idproduct = 240 $ [NC]

RewriteCond %{QUERY_STRING} ^idproduct=240$ [NC]

RewriteRule ^ store/scripts/prodView.asp $ index.php \?route = product/product \& path \ = 59 \& product_id \ = 50? [L,NC,R = 301]

RewriteRule ^store/scripts/prodView.asp$ index.php\?route=product/product\&path\=59\&product_id\=50? [L,NC,R=301]

.htaccess在根目录中

.htaccess is in the root

有人可以建议我可能要去哪里吗?谢谢

Can anyone suggest where I may be going wrong? Thank you

推荐答案

尝试使用:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^idproduct=240$ [NC]
RewriteRule ^store/scripts/prodView\.asp$ index.php?route=product/product\&path=59\&product_id=50 [L,NC,R=301]

RewriteRule网址中没有\?

Without \? in RewriteRule url

这篇关于htaccess将Apache RewriteRule .asp转换为.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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