Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中为重复URL AB文本添加查询字符串_Php - Fatal编程技术网

如何在php中为重复URL AB文本添加查询字符串

如何在php中为重复URL AB文本添加查询字符串,php,Php,现在我使用PHP进行我的工作,它有大约20页。我需要复制所有的URL以及AB测试的查询字符串 Original : www.lorem.com/index.php Duplicate: www.lorem.com/index.php?custom (Something like that) 感谢您的团队一个好的解决方案是在.htaccess文档中使用URL重写方案。类似于以下的解决方案可能有效: <IfModule mod_rewrite.c> RewriteEngine On R

现在我使用PHP进行我的工作,它有大约20页。我需要复制所有的URL以及AB测试的查询字符串

Original : www.lorem.com/index.php
Duplicate: www.lorem.com/index.php?custom (Something like that)

感谢您的团队

一个好的解决方案是在
.htaccess
文档中使用URL重写方案。类似于以下的解决方案可能有效:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*)/custom$ /$1-test.php [QSA,NC,L]
</IfModule>
请查看以下内容,以供URL重写参考:

Original  : www.lorem.com/index.php
Duplicate : www.lorem.com/index-test.php (When /custom is appended, this page is shown)