Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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
Php 如何在wordpress中重定向URL_Php_Wordpress_.htaccess_Redirect - Fatal编程技术网

Php 如何在wordpress中重定向URL

Php 如何在wordpress中重定向URL,php,wordpress,.htaccess,redirect,Php,Wordpress,.htaccess,Redirect,我以前使用PHP创建过我的网站,因此所有页面URL扩展都以PHP扩展结束,比如www.example.com/about us.PHP,我在其他一些地方共享了这些URL 但是现在我在wordpress中创建了这个网站,所以所有的URL都像www.example.com/about-us 现在我如何将www.example.com/about-us.php重定向到www.example.com/about-us你也可以这样做,转到管理面板,点击设置下的permalinks。然后你会注意到Url设置

我以前使用PHP创建过我的网站,因此所有页面URL扩展都以PHP扩展结束,比如
www.example.com/about us.PHP
,我在其他一些地方共享了这些URL

但是现在我在wordpress中创建了这个网站,所以所有的URL都像
www.example.com/about-us


现在我如何将www.example.com/about-us.php重定向到www.example.com/about-us

你也可以这样做,转到管理面板,点击
设置下的
permalinks
。然后你会注意到Url设置的选项。根据你的需要,你需要选择
Post name
,然后你所有的Url都会喜欢你的(www.example.com/about us)

您可以将此规则放在WP的.htaccess文件的“重写基线”下方,以重定向
。php
链接:

RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule !(^|/)wp-login\.php$ /%1 [R=301,L,NC,NE]

这与apache处理程序有关,删除.php extensionI只创建了该格式的页面,但现在我需要从about-us.php重定向,我在thatanubhava中分享了如何允许wp-login.php的详细信息。没有成功,url.com/wp-login.php重定向到url.com/wp-login,返回找不到的页面