how to create fresh .htaccess in site’s root access directory?
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.