Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/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
.htaccess htaccess查询字符串重定向不工作_.htaccess_Redirect_Mod Rewrite_Query String - Fatal编程技术网

.htaccess htaccess查询字符串重定向不工作

.htaccess htaccess查询字符串重定向不工作,.htaccess,redirect,mod-rewrite,query-string,.htaccess,Redirect,Mod Rewrite,Query String,我正在尝试使用RewriteCond和RewriteRule重定向到in.htaccess。这就是我到目前为止所做的: RewriteCond %{QUERY_STRING} ^(property=1234) RewriteRule ^$ /for-sale/property-name/? [R=301,L] 这是行不通的。我可以将?property=1234重定向到待售/property name/但如何使其在未重定向的URL中与/待售/一起工作?我曾尝试过多种组合,但都没有成功。 谢谢 我

我正在尝试使用RewriteCond和RewriteRule重定向到in.htaccess。这就是我到目前为止所做的:

RewriteCond %{QUERY_STRING} ^(property=1234)
RewriteRule ^$ /for-sale/property-name/? [R=301,L]
这是行不通的。我可以将?property=1234重定向到待售/property name/但如何使其在未重定向的URL中与/待售/一起工作?我曾尝试过多种组合,但都没有成功。 谢谢
我所有的链接现在都断了,所以我非常感谢你的建议。谢谢。

这是一个wordpress网站,所以第一个错误是在wordpress重写之后再重写。第二个错误是重写规则。以下是工作代码:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /

RewriteCond %{QUERY_STRING} property=1234$
RewriteRule ^for-sale/?$ /for-sale/property-name/? [R=301,L]

 ... my other rewrites

</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

重新启动发动机
重写基/
RewriteCond%{QUERY_STRING}属性=1234$
是否重写规则^for sale/?$/for sale/物业名称/?[R=301,L]
... 我的其他重写
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

这很有效。希望它能帮助其他人。

不,它是由WordPress生成的,来自“register\u post\u type”中的“rewrite”参数。我发现问题并解决了,请看下面的答案。