.htaccess, 404 error and LAMP server
In my fresh LAMP server, after updating WordPress permalink settings as acustom one, I got 404 error for all pages and posts.
After some searchs and readings, simply I can fix this issue.
First we want to enable the rewrite module in APACHE web server.
sudo a2enmod rewrite
Then restart the web server to apply the changes:
sudo service apache2 restart
In WordPress, it utilize .htaccess file to updates its Apache and PHP configuration. That means we are using mod_rewrite in .htaccess files.
If we are using mod_rewrite in .htaccess files, we also want to enable the use of .htaccess files by changing AllowOverride None to AllowOverride All.
For the default website, edit /etc/apache2/sites-available/default.conf or /etc/apache2/sites-available/000-default.conf:
<Directory var/www/>
Options FollowSymLinks
AllowOverride All
</Directory>
After such a change, we want to restart Apache again.
sudo service apache2 restart
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- Automating Code Linting with GitHub Actions for WordPress Plugins
- Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
- The Ultimate Guide to Indexing in Database Design
- Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
- A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.