Hi, I am logged in as a root user. I could enter /var/www/html. But I dont find the htaccess file? I installed WordPress 5.8 Ubuntu 20.04 with the one click installer. What do I have to do to access the htaccess file? Do I have to set up AllowOverride all? I cant get into /etc/apache2/apache2.conf as a root user. It says permission denied. Or do I have to install something?
Thank you in advance
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi @neverdevelopment,
It’s strange that you can’t edit your Apache2 files however it’s not necessary to do so. The changes you are looking for can be added in your .htaccess file.
To be sure your DocumentRoot is
/var/www/html
, you can check your Apache2 website’s conf likecat /etc/apache2/sites-enabled/000-default.conf
. In there you’ll see the DocumentRoot, it should be/var/www/html
but check to be sure.Now, once you are sure the DocumentRoot path, create the .htaccess file
Don’t forget to change the file’s ownership
Now, in the file, you can add the standard WordPress .htaccess info:
That should be it.
Hi there,
You don’t need to make any changes to the Apache config file as the
AllowOverride
is already enabled in the Apache virtual host for the default site here:You can create a new
.htaccess
file with the following command:Here is an example of a default
.htaccess
file content that you could then add to the file:Another alternative way of quickly generating the file without manually creating it is to go to the
wp-admin
-> click on settings -> then Permalinks -> change the permalinks settings and click save. This will automatically create a new.htaccess
file for you.Hope that this helps!
Best,
Bobby