如何重定向与.httacess [英] How to redirect with .httacess
本文介绍了如何重定向与.httacess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想重定向
http://www.example.com/component ?/工厂/视图=植物放;植物ID = 477 至 http://www.example.com/component/plant/?view =工厂和ID = 477
我需要从URL最后删除字厂。 我试过,但没有得到正确的结果。
I need to delete word plant from the url last. I tried this but didnt get the proper result
RewriteEngine On
# Capture (\d+) into %1
RewriteCond %{QUERY_STRING} plant-id=(\d+) [NC]
# And rewrite (redirect) into id=%1
RewriteRule ^(.*)$ /component/plant/?view=plant&$1?id=%1 [L,R=301]
但它不是我的正常工作,任何帮助,请。
But its not work fine for me , any help please.
感谢
推荐答案
这应该为你工作:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(view=plant)&plant-id=([0-9]*)(?:&|$) [NC]
RewriteRule ^(component/plant)/?$ /$1/?%1&id=%2 [L,NC,R=301]
这篇关于如何重定向与.httacess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文