Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.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永久链接不起作用_Php_Wordpress_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php Wordpress永久链接不起作用

Php Wordpress永久链接不起作用,php,wordpress,apache,.htaccess,mod-rewrite,Php,Wordpress,Apache,.htaccess,Mod Rewrite,我已经将WordPress网站迁移到新的服务器(Ubuntu)上,运行良好 但是永久链接设置不起作用。所有其他页面返回我404错误 我已经启用了mod\u rewrite 当我使用自定义结构并键入/%postname%时,它会显示已更新的永久链接结构。并且在访问页面时返回be 404错误 我正在使用/var/www/html/wordpress安装目录/作为文件夹,我已将/etc/apache2/sites available/000 defaul config更改为 DocumentRoot/

我已经将WordPress网站迁移到新的服务器(Ubuntu)上,运行良好

但是永久链接设置不起作用。所有其他页面返回我404错误

我已经启用了
mod\u rewrite

当我使用自定义结构并键入/%postname%时,它会显示已更新的永久链接结构。并且在访问页面时返回be 404错误

我正在使用/var/www/html/wordpress安装目录/作为文件夹,我已将/etc/apache2/sites available/000 defaul config更改为

DocumentRoot/var/www/html/wordpress安装目录

在我的.htaccess文件中

# 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
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
知道怎么回事吗?

试试看

未启用AllowOverride 您的服务器可能未启用AllowOverride指令。如果在Apache httpd.config文件中将AllowOverride指令设置为None,则完全忽略.htaccess文件。在这种情况下,服务器甚至不会尝试读取文件系统中的.htaccess文件。当此指令设置为All时,则在.htaccess文件中允许任何具有.htaccess上下文的指令。httpd.config中启用的AllowOverride指令示例:

<Directory />
    Options FollowSymLinks
    AllowOverride All
 </Directory>

选项如下符号链接
允许超越所有
您可能还必须在DocumentRoot中启用AllowOverride指令:

<Directory /var/www/html>
    # ... other directives...
    AllowOverride All
 </Directory>

You may also have to change the AllowOverride settings for the site. This is surely the case when using Mac OS X Server, but might be likewise with other systems. Usually you can find the site configuration files in /etc/httpd/sites/ 

If you don't want to set AllowOverride to all (as it is above) then your AllowOverride list must include the FileInfo directive. You must restart your Apache server for any httpd.config file changes to take effect. For more information on which overrides are allowed, read about Apache Core Features. 

# ... 其他指令。。。
允许超越所有
您可能还必须更改站点的AllowOverride设置。在使用MacOSX服务器时肯定是这样,但在其他系统中也可能是这样。通常您可以在/etc/httpd/sites/
如果您不想将AllowOverride设置为all(如上所述),则AllowOverride列表必须包含FileInfo指令。要使任何httpd.config文件更改生效,必须重新启动Apache服务器。有关允许哪些重写的更多信息,请阅读Apache核心功能。

Wordpress永久链接修复程序

1.打开phpmyadmin

2.查找wordpress数据库

3.查看wp_选项表

4.检查前两个字段,并使用正确的wordpress位置更新选项_值

5.重新加载permalink


对于像我这样在启用mod rewrite的情况下永久链接有问题的人,
允许覆盖vhost中的所有
,以及.htaccess中的所有良好指令

我花了几个小时才发现我在http(:80)的vhost中放入了
AllowOverride All
,但在https(:443)的vhost中没有


希望这能为您节省一些时间。=)

WordPress永久链接修复程序

  • 打开phpMyAdmin

  • 找到你的WordPress数据库

  • 查找
    wp\u选项
    表格

  • 查找
    permalink\u结构
    将值设置为空白

  • 如有必要,在
    .htaccess
    中抑制/注释
    modrewrite
    行 您的WordPress处于普通永久链接模式


  • 如果
    modrewrite
    未激活且交互式设置不起作用。

    检查wordpress文件夹的权限
    sudo chown www-data:www-R wordpress
    sudo chmod-R 777 wordpress
    我已授予上述权限。仍然不工作删除
    .htaccess
    文件一次,然后转到永久链接并提交一次。我再次这样做。还是不适合我。它使用与上面相同的代码再次创建了一个.htaccess文件确定但不要自己创建htaccess,htaccess是在提交permalink时创建的。试一下