I set up htaccess file and when I tried to save it I am informed that no such file exists.

Posted February 11, 2014 6.5k views
I wanted to set up custom rewrite rules in my htaccess file as I have installed wordpress. I followed this article to the dot I opened my htaccess file, edited it and tried to save it. I am informed that No such file or directory exists. I have no clue to sort it out.

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
3 answers
What command are you using to edit the file? Make sure the path exists.
I did the following steps

Alternatively you can use this command, replacing the with the name of your site, to create your .htaccess file in terminal.
sudo nano /var/www/

How to permit changes in the .htaccess file:
To allow the .htaccess file to override standard website configs, start by opening up the configuration file. NB: You will need sudo privileges for this step.

sudo nano /etc/apache2/sites-available/default

Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

After you save and exit that file, restart apache. .htacess files will now be available for all of your sites.

sudo service apache2 restart


sudo nano /var/www/


edited it and tried to save it and that is when the problem occurred
Does /var/www/ exist? If yes, you can simply ignore that error and save the file.