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

February 11, 2014 2.2k 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 https://www.digitalocean.com/community/articles/how-to-set-up-mod_rewrite 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.
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 example.com with the name of your site, to create your .htaccess file in terminal.
sudo nano /var/www/example.com/.htaccess

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/udprakash.com/.htaccess


edited it and tried to save it and that is when the problem occurred
Does /var/www/udprakash.com exist? If yes, you can simply ignore that error and save the file.
Have another answer? Share your knowledge.