Question

how to create fresh .htaccess in site's root access directory?

Posted September 6, 2021 80 views
WordPress

how to create fresh .htaccess in site’s root access directory?

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.

×
Submit an Answer
1 answer

Hi @faizytheace,

To create your .htaccess file, you’ll first need to SSH to your droplet. Once inside, if you are not sure where is your DocumentRoot folder of your domain, you’ll need to open your Apache config.

The Apache config is located in /etc/apache2/sites-enabled. Usually, the file would be called just like your domain but in some cases, the file would be called default.

Once you are sure which file it is, you can use cat to see the content of the file and list it. In there you’ll see the DocumentRoot folder:

cd /path/to/website
touch .htaccess
nano .htaccess

That’s it, you can now edit the file.