【发布时间】:2015-02-02 12:56:30
【问题描述】:
出于测试目的,我想将查询字符串(假设为 testing=true)附加到从我的网站请求的任何 url。
例如我要改变
- example.com
- example.com/product
- example.com/search?q=string
到
- example.com?testing=true
- example.com/product?testing=true
- example.com/search?q=string&testing=true
我试过这个:
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>
【问题讨论】:
标签: apache .htaccess codeigniter mod-rewrite url-rewriting