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:


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

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

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


        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

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

你可能感兴趣的:(WordPress问题记录)