Home HTACCESS How do you edit the .htaccess file

How do you edit the .htaccess file

Before you upload an .htaccess file to your server, make sure there is not already one there. Your host panel or perhaps a script you have uploaded may have already changed the htaccess for some reason so you don’t want to overwrite it as doing so could change something important on your site. For example, in cpanel, you can setup 301 redirects very easily but this tool is simply a script which changes the .htaccess for you. So even though you may not realise it, when you use the redirect script via cpanel, it updates your .htaccess file for you and it’s the .htaccess file which controls the redirect for you (the redirect tool just makes it easier for those who are not familar with .htaccess).

So if there is an .htaccess file there already, you want to download that and edit it before reuploading. This will ensure that nothing you have setup previously is changed.

If there is no .htaccess file there then you need to create one. Thankfully, this is very easy to do. All you need to do is open a text editor and save a blank document as .htaccess. Save the file exactly as it is stated there in bold ie. there is no writing before the extension. You need to save it as .htaccess and not htaccess.txt or document1.htaccess or whatever.

When uploading you should always :

  • Upload in ASCII mode, not binary
  • CHMOD the file to 644 (this isn’t absolutely necessary per say but it’s advisable, it means your server can access it but it can’t be seen via a browser).

You may also like

Leave a Comment