URL重定向规则添加firstvar =& secondvar =

时间:2018-06-14 22:56:20

标签: php .htaccess url-rewriting

我的网站的htaccess文件和重写规则存在问题。

以下代码处理我的页面链接

RewriteRule  ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?firstvar=$1&secondvar=$2    [NC,L]
RewriteRule  ^([A-Za-z0-9-]+)/?$  index.php?firstvar=$1 [NC]
RewriteRule  ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?firstvar=$1&secondvar=$2&thirdvar=$3&fourthvar=$4    [NC,L]
RewriteRule  ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?firstvar=$1&secondvar=$2&thirdvar=$3&fourthvar=$4&fifthvar=$5    [NC,L]
RewriteRule  ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?firstvar=$1&secondvar=$2&thirdvar=$3&fourthvar=$4&fifthvar=$5&sixthvar=$6    [NC,L]

我遇到的问题是,每当我尝试将一个页面重定向到另一个页面时,它都会添加搜索引擎会选择的其他字符。

实施例

如果我尝试将example.com/2442/18-title重定向到example.com/2442/40-title

然后我会看到example.com/2442/18-title?firstvar=2442&secondvar=40-title

添加?firstvar = 2442& secondvar =

我需要的是将其重定向到example.com/2442/18-title而不添加?firstvar = 2442& secondvar =在中间使其成为另一个URL,搜索引擎选择并添加到重复的URL

请在您的建议之前我想告诉您上述代码处理内部网址,如果我将其删除,则网址会中断

提前致谢

0 个答案:

没有答案