出于testing的目的,我想追加一个查询string(让我们说testing=真)到我的网站要求的任何url。
比如我想改变
example.com
example.com/product
example.com/search?q=string
至
example.com? testing=真
example.com/product? testing=真
example.com/search?q=string&test = true
我试过这个:
HTTPS强制redirect不能在wordpress中工作
使用GET参数时,Apache Redirect 301失败,例如?blah =
.htaccess重写通配符subsubdomain和params
如何通过使用`RewriteRule ^(。*)$?id = $ 1 `获取文件目录槽.htaccess?
RewriteRule ^/?(.*) http://example.com/$1?testing=true [L,R,NE]
但它打破了网站。 不是专家。
有任何想法吗?
编辑:
我应该添加我正在与CodeIgniter(PHP)和我目前的.htaccess看起来像这样:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.PHP|public|images|robots.txt|css) RewriteRule ^(.*)$ index.PHP/$1 [L] </IfModule>
RewriteRule ^(。*)/ $?path = $ 1 是什么意思在我的.htaccess?
.htaccess重写程序在mac上无法正常工作
如何访问目录的index.PHP没有一个结尾的斜线,并没有得到301redirect
有没有可能在.htaccess文件中输出任何或所有可用的variables?
通过htaccess在url中隐藏文件扩展名
你可以使用这个新规则:
<Ifmodulee mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} !(^|&)testing=true(&|$) [NC] RewriteRule ^ %{REQUEST_URI}?testing=true [L,QSA,R] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.PHP|public|images|robots.txt|css) RewriteRule ^(.*)$ index.PHP/$1 [L] </Ifmodulee>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。