Stack Overflow Asked by sotn on December 28, 2020
I am unable to set permalinks to end with post names. I receive a 404 error. The closest I got is to set custom permalink to:
/index.php/%postname%
But this causes ‘index.php’ to show up in the URL. I also updated my httpd.conf to set the root dir to:
AllowOverride All
But it still does not work. My wordpress is hosted on AWS EC2 linux AMI.
Activate the mod_rewrite module with
sudo a2enmod rewrite
and restart the apache
sudo service apache2 restart
To use mod_rewrite from within .htaccess files (which is a very common use case), edit the default VirtualHost with
sudo nano /etc/apache2/sites-available/000-default.conf
Below “DocumentRoot /var/www/html” add the following lines:
<Directory “/var/www/html”>
AllowOverride All
</Directory>
Restart the server again:
sudo service apache2 restart
EDIT:
Found my htaccess file was missing. So followed the steps listed here :
https://wordpress.org/support/article/using-permalinks/#wheres-my-htaccess-file
Postname permalink now works!
Correct answer by Kishor Patidar on December 28, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP