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.
Click below to sign up and get $200 of credit to try our products over 60 days!
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 like
cat /etc/apache2/sites-enabled/000-default.conf. In there you’ll see the DocumentRoot, it should be
/var/www/htmlbut 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.
You don’t need to make any changes to the Apache config file as the
AllowOverrideis already enabled in the Apache virtual host for the default site here:
You can create a new
.htaccessfile with the following command:
Here is an example of a default
.htaccessfile 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
.htaccessfile for you.
Hope that this helps!