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

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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

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.