Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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
Wordpress 301将带有参数的url重定向到非尾随斜杠url(htaccess)_Wordpress_.htaccess_Redirect_Slash_Trailing - Fatal编程技术网

Wordpress 301将带有参数的url重定向到非尾随斜杠url(htaccess)

Wordpress 301将带有参数的url重定向到非尾随斜杠url(htaccess),wordpress,.htaccess,redirect,slash,trailing,Wordpress,.htaccess,Redirect,Slash,Trailing,嗨,我们正在apache服务器中使用wordpress 我们希望301将带有尾随斜杠的特定路径重定向到非尾随斜杠 例如: 到 我们如何使用htaccess实现这一点 我在网站上搜索过,但我找不到像htaccess这样的内容重定向URL 感谢您的帮助要删除尾随斜杠,请将其添加到。htaccess: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [R=301,L] 在

嗨,我们正在apache服务器中使用wordpress

我们希望301将带有尾随斜杠的特定路径重定向到非尾随斜杠

例如:

我们如何使用htaccess实现这一点

我在网站上搜索过,但我找不到像htaccess这样的内容重定向URL


感谢您的帮助

要删除尾随斜杠,请将其添加到
。htaccess

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

在测试此操作之前,请确保清除缓存。。

但我们希望重定向路径,就像示例中的一样,不是所有URL:/您是如何在查询字符串中获得带有尾随斜杠的第一个URL的?