When the WordPress home page opens but posts, pages, products, or custom content URLs return 404, it is usually caused by missing rewrite rules, the `.htaccess` file not being read, an incorrect subdirectory path, or plugins breaking the managed WordPress rewrite block.
404 Not Found
The requested URL was not found on this server
WordPress permalinks not working
Rewrite rules flushed
.htaccess is not writableWhen the WordPress home page opens but posts, pages, products, or custom content URLs return 404, it is usually caused by missing rewrite rules, the `.htaccess` file not being read, an incorrect subdirectory path, or plugins breaking the managed WordPress rewrite block.
Do not expect a `.htaccess` result without reserving the Apache, LiteSpeed, Plesk proxy or NGINX-only structure.
Back up the current file with the date; Find the directive and line in the Apache/LiteSpeed error log.
Do not change redirect, rewrite, header and access rules all at the same time.
Measure the status, Location, Content-Type and redirect number with curl and check the cache layers separately.
Do not randomly mix plugin code with the WordPress managed rewrite block.
Meaning: The front-controller rewrite is not being applied.
Possible cause: The WordPress block is missing or mod_rewrite is disabled.
Meaning: WordPress cannot automatically write rules to the file.
Possible cause: Ownership or file permission.
Meaning: Product rewrite rules are outdated.
Possible cause: Slug change, migration, or cache.
Meaning: The rewrite registration for the new content type has not been refreshed.
Possible cause: No flush after plugin or theme activation.
Meaning: The RewriteBase or index.php path is set as a root installation.
Possible cause: WordPress is in the `/blog` subdirectory.
Meaning: No rules suitable for the network type.
Possible cause: Subdomain and subdirectory rules are mixed.
Meaning: Cache layer holds the old route result.
Possible cause: Object/page/CDN cache.
Meaning: WordPress rewrite should be done with NGINX `try_files`.
Possible cause: NGINX-only hosting.
No records matching this expression were found.
wp rewrite flush --hardRefreshes the rewrite rules with WP-CLI and updates the `.htaccess` file in supported environments.
wp rewrite structure && wp rewrite list --format=table | head -n 40Shows the active permalink structure and initial rewrite rules.
stat -c '%a %U:%G %n' .htaccess wp-config.php index.php 2>/dev/null || stat -f '%Lp %Su:%Sg %N' .htaccess wp-config.php index.phpShows the ownership and permissions of critical WordPress files.
apachectl -M 2>/dev/null | grep rewriteCheck if Apache rewrite module is loaded.
curl -sS -o /dev/null -w 'HTTP:%{http_code} Final:%{url_effective}\n' -L https://example.com/ornek-yazi/Displays the HTTP result of a permalink URL.
wp option get home && wp option get siteurl && wp option get permalink_structureShows the Home URL, Site URL, and permalink structure.
RewriteRule ^ index.php [L]<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>RewriteBase /
RewriteRule . /index.php [L]RewriteBase /blog/
RewriteRule . /blog/index.php [L]RewriteRule . /index.php [L]RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]RewriteEngine On
RewriteRule . /index.php [L]location / {
try_files $uri $uri/ /index.php?$args;
}Permalink registration, custom post types, and product slugs should be examined together.
The WordPress root and LiteSpeed cache rules inside public_html are important.
WordPress may be on a subdirectory or subdomain; if NGINX-only, `.htaccess` has no effect.
No. NGINX does not read `.htaccess` files. The rule must be translated to a `server` or `location` configuration.
Usually not; Apache evaluates the `.htaccess` file on each request. However, a reload or restart is required for VirtualHost, module, or AllowOverride changes.
A dated backup of the existing file should be taken, the active document root verified, and the change tested on staging or during low-traffic periods.
In cPanel it is usually inside `public_html`, in Plesk inside `httpdocs`; addon domains and subdomains may have a different document root.
LiteSpeed supports most rules through Apache compatibility; some module and handler behaviors may differ.
Full directive and line record in Apache/LiteSpeed error log. The file should be restored according to the log instead of being deleted randomly.
Domain should not be added directly without verifying domain, document root, proxy, WordPress, and server structure. Examples should be adapted and tested.
We examine redirection, rewrite, CORS, access and 500 errors with logs in cPanel, Plesk, LiteSpeed, WordPress, custom PHP and WISECP structures.