Applicable to:
- Plesk for Linux
Symptoms
-
Website pages based on WordPress hosted on Plesk server are not accessible. The following error is shown in browser:
CONFIG_TEXT: 404 Not Found
when:
- FPM application served by Apache or FastCGI handler is set in Plesk > Domains > example.com > PHP Settings
- Non Plain is set in WordPress Dashboard > Settings > Permalinks type
- FPM application served by Apache or FastCGI handler is set in Plesk > Domains > example.com > PHP Settings
-
WordPress REST API point (wp-api) shows 404 error. It can be checked by accessing
http://example.com/wp-json/wp/v2/posts
Cause
Rewrite rules are not adjusted to work with WordPress permalinks.
Resolution
- Login to Plesk.
- Go to Domains > example.com > WordPress > Log in
- Go to Settings > Permalinks
- Click on Save Changes
-
Go to Domains > example.com > File Manager > httpdocs
-
Create the
.htaccess
file by clicking on it or edit existing.htaccess
and add below lines:CONFIG_TEXT: # BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress -
Click Save button
-
Edit the file
/var/www/vhosts/example.com/httpdocs/.htaccess
or create it if does not exist and add below lines:CONFIG_TEXT: # BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Additional information
Website pages based on WordPress show "404 Not Found" when PHP-FPM by Nginx and Proxy Mode are used
Comments
3 comments
Go to Domains > example.com > Apache & Nginx settings
Paste the following code into Additional directives for HTTPS
Error:
Configurazione Apache non valida: AH00526: Syntax error on line 3 of /var/www/vhosts/system/demo.testsite.it/conf/vhost.conf: RewriteBase: only valid in per-directory config files
@Fabio
Yes, first solution doesn't work, I removed it. Use .htaccess file.
Thank you.
Just for reference, this WordPress Toolkit bug fix was my issue and resolved the 404s for all WordPress subpages:
https://support.plesk.com/hc/en-us/articles/360014152320--BUG-mod-rewrite-stopped-working-All-pages-on-WordPress-sites-show-404
Please sign in to leave a comment.