WordPress 多言語サイト作成

WordPress で多言語サイトを作成する - WordPress Codex 日本語版
https://wordpress.org/support/article/multilingual-wordpress/

タイプ別に解説!WordPressを多言語にするプラグイン10選 2019
ゲーム・アニメの多言語化WebサイトをWordPressで構築するポイント | Blog | 株式会社イロコト | アニメ・ゲームなどのエンタメ系Web制作&運用会社 2021 qTranslate-XT

Search form spam 検索 スパム

【注意喚起】急増する他社サイトを利用するサイト内検索スパム内容と対策 - ブログ - 株式会社JADE 2023

WordPress利用者は今すぐチェック!サイト内検索結果ページに『noindex』設定をしていないとスパム攻撃の対象となり危険です | インフォコネクト株式会社 2021

WordPress向けの検索フォームを使ったスパムについて | KEI SAKAKI's PAGE. 2017

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot) [NC]
RewriteCond %{QUERY_STRING} ^s= [OR]
RewriteCond %{REQUEST_URI} ^/search/
RewriteRule ^ - [F]

Search Spam! | WordPress.org

単純な先頭 /?s= でない /?action=QUERY&s=xxx のようなアクセスが出てきた

RewriteCond %{HTTP_USER_AGENT} (AhrefsBot|bingbot|BLEXBot|Googlebot|PetalBot|SemrushBot) [NC]

2024.04.03 GoogleOtherというUAでのアクセス

例
"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.94 Mobile Safari/537.36 (compatible; GoogleOther)"

RewriteCond %{HTTP_USER_AGENT} (AhrefsBot|bingbot|BLEXBot|Googlebot|GoogleOther|PetalBot|SemrushBot) [NC]

XMLRPC

Nginx

To block access to xmlrpc in nginx use the following configuration:

location = /xmlrpc.php {
    deny all;
    return 404;
}

Apache

If you have access to your main Apache configuration file, use the code below there. Alternatively, create a file named .htaccess in your WordPress directory with the following contents:

<Files "xmlrpc.php">  
  Require all denied
</Files>

https://blog.wpscan.com/is-wordpress-xmlrpc-a-security-problem/

マルチサイト htaccess

Subdomain

SubDomain Example

WordPress 3.5+

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
 
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
 
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]
# END WordPress

https://wordpress.org/support/article/multisite-network-administration/#htaccess-and-mod-rewrite

WordPress 3.5 and up

SubDomain Example

# BEGIN WordPress Multisite
# Using subdomain network type: https://wordpress.org/support/article/htaccess/#multisite

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress Multisite

https://wordpress.org/support/article/htaccess/#wordpress-3-5-and-up

The usual rule redirects .php requests to an appropriate subfolder when used as RewriteRule ^(.*\.php)$ wp/$1 [L] like we see in the example in WP docs. But without the “wp/” it’ll just rewrite to the same place, causing an infinite loop situation, thus the 500 status.

Go to Network admin, then the Network Setup settings. Does the .htaccess code there exactly match what you have? If it does, you could try commenting the line out by placing a # at the start of the line. I’m not sure what impact it’ll have on your network, but I don’t see what purpose it serves if not to redirect to a different sub-folder.

https://wordpress.org/support/topic/multisite-htaccess/#post-15051764

Subdirectory

RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

サブフォルダで上記ルールに該当する存在しないファイルへのアクセスがあるとリダイレクトループが発生する。

/wp-content/uploads/sites/1/fbrfg/site.webmanifest が存在しない状態で
https://yournetwork.com/site1/wp-content/uploads/sites/1/fbrfg/site.webmanifest にアクセス

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to
increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

以下の方法で対処可

Ok. I messed around with this. I think I have something.

Instead of changing the rewrite rule, Change:

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

To:

RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

This works by checking internal Apache variable %{ENV:REDIRECT_STATUS}. This variable is empty at the start of rewrite module but is set to 200 when first successful internal rewrite happens. This above condition says bail out of further rewrites after first successful rewrite and stops looping.

WordPress Multisite: How to fix error "too many redirects" · GitHub

InnoDBに変換

3.WordPressのテーブルをInnoDBに変換する
あとはmysqlにログインし「ALTER TABLE テーブル名 engine=InnoDB;」を実行するだけです。
WordPressのDBをMyISAMからInnoDBに変更する | riscascape.net 2017

https://stackoverflow.com/questions/63767994/wordpress-mysql-how-to-fix-invalid-default-value-for-user-registered

The problem is because of sql_modes. Please check your current sql_modes by command:

show variables like 'sql_mode' ; 

And remove the sql_mode "NO_ZERO_IN_DATE,NO_ZERO_DATE" to make it work. This is the default sql_mode in mysql new versions.
mysql - ERROR 1067 (42000): Invalid default value for 'created_at' - Stack Overflow

wp db export (wp-cli) で生成したsqlsql_modeを変更して元に戻している

Revision リビジョン 削除

WordPressのリビジョン機能の使い方と最適化のコツ 2023

wp-cli

wp post delete $(wp post list --post_type='revision' --format=ids) --force

How To Delete Post Revisions using WP-CLI - Liquid Web 2023

wp post delete --force $( wp post list --post_type=revision --post_status=inherit --format=ids )

wp post delete 投稿ID で記事が削除できる。
wp post list 条件 で条件に合う投稿IDの一覧が取得できる。
revision はゴミ箱には入れれないので、 –force で物理削除。

wp-cli で不要なリビジョンデータを削除 at softelメモ 2022

投稿記事を「親」とするとその記事に添付する画像や動画、またリビジョン(編集履歴)等は親に付随するものとして「子」という意味合いになり、「継承(inherit)」という言葉が使用されていると理解すると覚えやすいかと思います。
【WP】投稿ステータスの「inherit(継承)」ってなに? – wp-note 2021

プラグイン

WP-Optimize

https://ja.wordpress.org/plugins/wp-optimize/

WordPressの肥大化したデータベースを最適化して容量を減らす方法 | WordPressのお医者さん 2019

▲ マルチサイト: Optimize database tables, Clean all post revisions などの対象がメインサイトのみ? 3.2.19 2023/10

WP-Sweep

https://ja.wordpress.org/plugins/wp-sweep/

自分が初めてこの「リビジョン削除」を行ったときは、「数万件」という膨大なリビジョンが溜まっていたせいか…
「掃除」ボタンをクリック後、「掃除中…」から動かなくなった
【2023年】WP-Sweepの導入手順&使い方を初心者向けに優しく解説【WordPressのリビジョン削除プラグイン】 2023

リビジョン数が多いとタイムアウト。一定数削除されてるので何度か実行する

◯ マルチサイト: OK 1.1.8 2023/10