デフォルトで www にリダイレクトするように設定されている WordPress Web サイトがあります。すべてが完全に機能しますが、ローカル サービスや宿泊施設などの「プロファイル」ページに移動するために、カスタム コードされたセクションがいくつかあります。これは、開発中は問題なく動作しますが、www.example.com 経由でリンクにアクセスすると、ライブ サーバー上で動作します。 /services/example-here/ example.com/wp-content/themes/theme-here/custom/services.php?slug=example-here にリダイレクトします
問題の原因は WordPRess であるとウェブホストから言われましたが、すべて www.example.com/ (siteurl など) と表示されています。
htaccess ファイル内のコードは次のとおりです。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^.*services/(.*)/$ /wp-content/themes/theme-here/custom/services.php?slug=$1 [QSA,L]
RewriteRule ^.*accommodation/(.*)/$ /wp-content/themes/theme-here/custom/accommodation.php?slug=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
すべての設定を確認したアイデアはありますか? mod の再書き込みを行うには、apache conf 内のホストの問題でしょうか? また、www を追加しなくてもコードが完全に機能することを付け加えるかもしれませんが、クライアントには www が必要です。