WordPress Permalink Issues and 404 Errors
Posts showing 404 errors even though they exist? Fix WordPress permalink problems.
Common Symptoms
- Homepage works but pages show 404
- Old URLs work but new ones don’t
- Changing permalinks breaks site
- Custom post types showing 404
Solution 1: Flush Permalinks
The Simple Fix
- Log into WordPress admin
- Go to Settings → Permalinks
- Don’t change anything
- Click Save Changes
- Test your links
Solution 2: Fix .htaccess File
Check if .htaccess Exists
- Access via FTP/File Manager
- Look in WordPress root
- Enable Show Hidden Files if needed
Regenerate .htaccess
- Delete or rename .htaccess
- Go to Settings → Permalinks
- Click Save Changes
- New .htaccess created
Default WordPress .htaccess
# BEGIN WordPressnRewriteEngine OnnRewriteBase /nRewriteRule ^index.php$ - [L]nRewriteCond %{REQUEST_FILENAME} !-fnRewriteCond %{REQUEST_FILENAME} !-dnRewriteRule . /index.php [L]n# END WordPress
Solution 3: Check File Permissions
Correct Permissions
- .htaccess file: 644 or 666
- Root directory: 755
Change via FTP
- Right-click .htaccess
- Select File Permissions
- Set to 644
- Apply
Solution 4: Enable mod_rewrite
Check if mod_rewrite is On
Create phpinfo.php:
<?php phpinfo(); ?>
Search for mod_rewrite. If not loaded, contact hosting.
Solution 5: Fix Permalink Structure
Choose Proper Structure
- Settings → Permalinks
- Select Post name (recommended)
- Or use Custom Structure: /%postname%/
- Save Changes
For Subdirectory Installs
If WordPress in subdirectory:
RewriteEngine OnnRewriteBase /subdirectory/nRewriteRule ^index.php$ - [L]nRewriteCond %{REQUEST_FILENAME} !-fnRewriteCond %{REQUEST_FILENAME} !-dnRewriteRule . /subdirectory/index.php [L]
Solution 6: Check Apache AllowOverride
Contact hosting to verify:
AllowOverride All
is set in Apache configuration
Solution 7: Custom Post Types
For custom post types, add to functions.php:
function my_rewrite_flush() {n flush_rewrite_rules();n}nadd_action('after_switch_theme', 'my_rewrite_flush');
Solution 8: Check Nginx Configuration
If on Nginx, need proper config:
location / {n try_files $uri $uri/ /index.php?$args;n}
Final mention: Please feel free to contact us for permalink troubleshooting.
