AnswerBun.com

Updating httpd.conf not working for permalinks

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.

Stack Overflow Asked by sotn on December 28, 2020

1 Answers

One Answer

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

  • Created htaccess in wp root which, on my server, was /var/www/html.
  • Added the required rewrite rules provided in the link above.
  • Set chmod on htaccess to 775
  • Set chown on htaccess to apache:apache
  • Restarted httpd service

Postname permalink now works!

Correct answer by Kishor Patidar on December 28, 2020

Add your own answers!

Related Questions

Java writing unlimited text lines to a UI

0  Asked on February 11, 2021 by barry-griffey

     

R simple dplyr solution to filter

3  Asked on February 11, 2021 by triss

     

Go back browser button action

2  Asked on February 11, 2021 by ljopata

 

How to pass array to funtion to use as range based for loop

3  Asked on February 10, 2021 by aniket-ujgare

   

react ref and query selector all

2  Asked on February 10, 2021 by peter-flanagan

     

Direct code execution through the JS browser console

0  Asked on February 10, 2021 by matheus-nascimento

 

How to correctly write word-break in css?

3  Asked on February 10, 2021 by aiko-schurmann

   

Finding a user data based on email

1  Asked on February 10, 2021 by aamer-salame

       

Can I use text when using functions? Or only numbers?

4  Asked on February 9, 2021 by osk6r

   

Get the string before replace

0  Asked on February 9, 2021 by tanker

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.