Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/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自定义永久链接将帖子重定向到根目录_Wordpress_Permalinks - Fatal编程技术网

Wordpress自定义永久链接将帖子重定向到根目录

Wordpress自定义永久链接将帖子重定向到根目录,wordpress,permalinks,Wordpress,Permalinks,我的博客url类似于www.example.com/blog,我的帖子url类似于https://www.example.com/blog/index.php/postname和永久链接设置为自定义/index.php/%postname%/ 我想删除博文url的blog/index.php,以便博文url是https://www.example.com/post-name 如果我将永久链接更改为与/%postname%/一起使用custom,它会将我的帖子重定向到404页面 您需要在.htac

我的博客url类似于
www.example.com/blog
,我的帖子url类似于
https://www.example.com/blog/index.php/postname
和永久链接设置为自定义/index.php/%postname%/

我想删除博文url的blog/index.php,以便博文url是
https://www.example.com/post-name

如果我将永久链接更改为与
/%postname%/
一起使用custom,它会将我的帖子重定向到404页面


您需要在
.htaccess
或类似版本(取决于所使用的服务器守护进程)中在服务器上编写自定义URL重写。Hi@belinus感谢您的回复。我已经试过了。htaccess。实际上是因为我的服务器nginx没有处理.htccess。现在问题解决了。