Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.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
.htaccess 重定向.html而不是.html?带=选项_.htaccess - Fatal编程技术网

.htaccess 重定向.html而不是.html?带=选项

.htaccess 重定向.html而不是.html?带=选项,.htaccess,.htaccess,我目前正在使用.htaccess来解决CMS的问题,没有什么大问题,而且htaccess修复程序足够整洁 我目前正在使用的格式 重定向301/pictures.html 但问题是CMS使用pictures.html?vars=在这里选择库,因此重定向中断了这部分内容。有什么方法可以重定向pictures.html,但当它附加了变量时不能重定向吗?通过检测IP地址,可以重定向除Web服务器之外的所有人,如下所示: Options +FollowSymlinks RewriteEngine on R

我目前正在使用.htaccess来解决CMS的问题,没有什么大问题,而且htaccess修复程序足够整洁

我目前正在使用的格式

重定向301/pictures.html


但问题是CMS使用pictures.html?vars=在这里选择库,因此重定向中断了这部分内容。有什么方法可以重定向pictures.html,但当它附加了变量时不能重定向吗?

通过检测IP地址,可以重定向除Web服务器之外的所有人,如下所示:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89
RewriteRule \.html$ /alternate_page.html [R=301,L] 

例如,添加如下内容

RewriteCond %{QUERY_STRING} ^$

在您的规则之前。

如果没有明确设置重写规则来执行重定向,这会起作用吗?我很确定重定向是重写的一个小版本,但是你能在不打开重写引擎的情况下加入重写条件吗?我想作者使用了
RewriteRule
。我对使用什么规则持开放态度,我已经打开了mod_rewrite。不过,我不确定该如何使用此解决方案。请将规则更改为类似于
RewriteRule/pictures.html$的内容http://www.domain.com/gallery.html [R=301,L]
并在其前面添加前面提到的
RewriteCond
。它根本不会重定向pictures.html:(