Архив рубрики: wordpress

wordpress log errors

Посмотреть ошибки можно в логах:

tail -f /var/log/php-fpm/* -n 1000
tail -f /etc/nginx/logs/* -n 1000
tail -f /va/log/mysql/* -n 1000

либо: link При работе над сайтом на CMS WordPress иногда нужно посмотреть какие логи выдает сайт. По стандарту это отключено. Заходим на сервер по FTP в папку админки. Нам нужен файл wp-config.php. Открываем его на редактирование. И в любом удобном месте нужно вставить следующие строчки:

define(‘WP_DEBUG’, 1); — дать возможность админке показывать ошибки

define(‘WP_DEBUG_DISPLAY’, 0); — чтобы эти ошибки не выводились в браузере

define(‘WP_DEBUG_LOG’, 1); — ну и создать лог файл

Сохраняем файл и заходим в папку wp-content где и будет на лог файл debug.log

Migrate http to https in wordpress

link

Configuring WordPress for SSL/HTTPS

Links in WordPress (such as image attachments, themes CSS and JavaScript files) are relative to the install URL.

To change WordPress from HTTP to HTTPS, the install URL must changed from sayhttps://designmodo.com to https://designmodo.com.

  • Login to your WordPress dashboard and navigate to Settings > General.
  • Ensure that the WordPress Address (URL) and Site Address (URL) are https. If not, add S after http to make https and save it.
WordPress General Settings

To easily enable (and enforce) WordPress administration over SSL, the constantFORCE_SSL_ADMIN should be set to true in your site’s wp-config.php file to force all logins and all admin sessions to happen over SSL.

1
define('FORCE_SSL_ADMIN', true);

The constant FORCE_SSL_ADMIN can be set to true to force all logins and all admin sessions to happen over SSL.

If your WordPress site uses a content delivery network (CDN) to serve its components (images, JavaScript, CSS style sheet), ensure the URLs are all https:// otherwise your website will be deem insecure by the web browser.

What’s Next?

Now that we’ve successfully moved WordPress to HTTPS, we still need to do two more things — set up a 301 permanent redirect and inform Google of the URL change.

To setup a 301 permanent redirect, FTP/SFTP to your server and add the code below at the top of WordPress’ .htaccess file.

1
2
3
4
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yoursite.com [NC]
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]

Change every instance of yoursite.com to your WordPress URL.

To inform Google about the change in URL, re-add your WordPress site to Google webmaster tool (but this time with https://) and follow this this guide to let Google know about the change of URL.

You can check your SSL website status using Qualys SSL Labs.

uploads wp

Аналог php_value engine off для 

В Apache проблема решается просто: в каталог uploads помещается .htaccessследующего содержания:

[-]
View Code Apache configuration
php_value engine off

В nginx .htaccess не предусмотрен (что можно рассматривать и как достоинство, и как недостаток), поэтому там нужно применить несколько другой подход.

В описание виртуального хоста помещаем следующие строки:

[-]
View Code nginx configuration
location ^~ /wp-content/uploads/ {
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php last;
}types {
text/plain php php3 php4 php5 phtml phps pl pm;
}
}

И заставить nginx перечитать конфигурацию:

[-]
View Code Bash
invoke-rc.d nginx reload

Для nginx 0.7.32 и выше есть другой вариант:

[-]
View Code nginx configuration
location ^~ /wp-content/uploads/ {
types {
text/plain php php3 php4 php5 phtml phps pl pm;
}try_files $uri $uri/ @wordpress;
}

Как выглядит location @wordpress, можно прочитать здесь.

Всё просто!™

wordpress переезд

http://dimox.name/moving-the-site-on-new-domain/

UPDATE wp_options SET option_value = replace(option_value, "http://domain.ru", "http://newdomain.ru"WHERE option_name = "home" OR option_name = "siteurl"
 UPDATE wp_posts SET guid = replace(guid,"http://domain.ru","http://newdomain.ru");
 UPDATE wp_posts SET post_content = replace(post_content, "http://domain.ru","http://newdomain.ru");
на старом robots.txt
User-Agent: *
Disallow:
Host: newdomain.ru
на старом .htaccess
<FilesMatch "robots.txt$">
RewriteEngine off
</FilesMatch>
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://newdomain.ru/$1 [R=301,L]