WordPress问题记录

问题一:上传主题压缩包提示失败,是因为初始值太小。
解决方法:How to fix maximum upload and php memory limit issues in WordPress ?
修改两个文件:
/etc/php/7.0/cli/php.ini
/etc/php/7.0/apache2/php.ini
memory_limit = 256M
upload_max_size = 64M
post_max_size = 64M
upload_max_filesize = 64M
max_execution_time = 300
max_input_time = 1000

wp-config.php
php_value memory_limit 256
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000

如果要import demo,报错Class 'XMLReader' not found in WXRImporter.php:123
sudo apt-get install php-xml
问题二:
只能打开主页,点击链接跳转,会跳出来自己的ip地址,而不是域名
你进入WordPress 后台->设置->WordPress地址(URL)和站点地址(URL)->改成你站点域名
解决办法

问题三:
只能打开主页,点击主页上链接后,又提示request url cannot found
解决办法

问题四:
WordPress链接中一直有index.php,如何去除?去除之后又提示404 not found。

WordPress固定链接自定义时出现404:

自定义好的固定链接访问后出现404,多是服务器没有开启URL_Rewrite的支持,所以先去服务器设置。
Remove index.php from Wordpress URL
To remove index.php from your Wordpress URL you will need to do three things.
The first step is updating the Permalinks within the Wordpress Dashboard.

1、Login to your Wordpress Dashboard and Click Settings > Permalinks. Under Common Settings, Select Custom Structure and in the text field enter /%postname%/

Click SaveChanges

image.png

2、The second step is creating an .htaccess file which is then uploaded into the root location of the Wordpress site.

The .htaccess file will contain the below rules:

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

Apache环境下开启url_rewrite:
上面配置完了,还需要开启Apache的url_rewrite。
sudo a2enmod rewrite

如果你是debian或者Ubuntu,按照下面操作:
1、进入/etc/apache2/,查找apache2.conf
2、找到AllowOverride,把AllowOverride None修改成AllowOverride All
3、添加如下代码--这一步好像非必须

<Directory /your/path/to/wordpress>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

sudo service apache2 restart 应该就能去除链接中index.php

如果你是centos,则按照下面操作:

  1. 开启apache的url_rewrite模块,也就是在httpd.conf中去掉这句话的注释LoadModule rewrite_module modules/mod_rewrite.so
  2. 找到AllowOverride,把AllowOverride None修改成AllowOverride all
  3. 在所需要进行rewrite的web的主目录下添加.htaccess文件,添加上一句话:RewriteEngine on

如果你是Nginx,参考下面方法:
Nginx环境下开启url_rewrite:
nginx只需要打开nginx.conf配置文件,在server里面写需要的规则,然后重启即可。
具体的重写规则参考:http://codex.wordpress.org/Nginx

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,526评论 25 709
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,428评论 19 139
  • 用两张图告诉你,为什么你的 App 会卡顿? - Android - 掘金 Cover 有什么料? 从这篇文章中你...
    hw1212阅读 14,477评论 2 59
  • 某天,在网上看到有博主发起每月一个好习惯的活动,我觉得自己也有很多不良的习惯需要改正,从这个月开始我也给自己定下计...
    暖手尹小莫阅读 2,767评论 0 2
  • 一直觉得,微信朋友圈仅三天可见是个不友好的设定。它显得冰冷,不近人情。像是一堵墙立于时间长河,横隔了过去,与现在割...
    寻霄阅读 1,144评论 0 2