htaccess的 - 添加字符串结束网址 [英] htaccess - add string to end url
本文介绍了htaccess的 - 添加字符串结束网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
URL是像
http://www.example.com/?p=3733&$p$pview=true
和我想补充?ModPagespeed =无脚本
所以它成为 http://www.example.com/?p=3733&$p$pview=true?ModPagespeed=off
P =是动态的,顺便说一句
p= is dynamic btw
任何想法?
推荐答案
把这个code在 DOCUMENT_ROOT /的.htaccess
文件:
put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)p=[^&]+
RewriteCond %{QUERY_STRING} (^|&)preview=true(&|$)
RewriteCond %{QUERY_STRING} !(^|&)ModPagespeed=off(&|$)
RewriteRule ^$ %{REQUEST_URI}?ModPagespeed=off [L,QSA,R]
更新:如果您想与最终URL 2
在里面,使用这样的规则:
UPDATE: If you want final URL with 2 ?
in it, use this rule:
RewriteCond %{QUERY_STRING} (^|&)p=[^&]+
RewriteCond %{QUERY_STRING} (^|&)preview=true(&|$)
RewriteCond %{QUERY_STRING} !(^|&)ModPagespeed=off(&|$)
RewriteRule ^$ %{REQUEST_URI}?%{QUERY_STRING}?ModPagespeed=off [L,NE,R]
这篇关于htaccess的 - 添加字符串结束网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文