How to Edit WordPress .htaccess File

Earlier, I posted about WordPress .htaccess file and here I’m sharing a quick tutorial on how to edit WordPress. htaccess file. There are many methods which you can follow to do the same, here we will look into three of them: cPanel method, WordPress dashboard and using any FTP client from desktop.

Edit WordPress htaccess File

More over when you edit your WordPress permalink, you need to update your .htaccess file. If you are a self hosted WordPress user, you should know about .htaccess file and how to edit it. In this tutorial, I will be sharing how you can edit WordPress .htaccess file using a free FTP client like  FileZilla.

How to edit WordPress .htaccess file using cPanel:

Most of the Web hosting companies offers cPanel, which makes it easier for non-technical people to play and edit .htaccess file. In this part, we will learn using cPanel method to edit. htacess file. This is especially, useful for non-technical people who needs to add or edit some codes and they can quickly do it using online editor.

Login to your cPanel, and click on File manager under Files section.

Depending upon your WordPress installation directory, you will find .htaccess at the root of your WP installation. If you don’t see it yet, refer to my Create WordPress .Htaccess notes to add one. Select .Htaccess file and click on Edit file, it will open editor in new tab and you can make changes right from there.

Edit WordPress .htaccess

Make changes and save the file and verify the same.

Editing .Htaccess from WordPress dashboard:

There are many WordPress plugins which offers feature to edit Htaccess file from WP dashboard. If you are using SEO by yoast plugin, you can access it from SEO by yoast > Edit files settings.

Editing file using FTP client:

This is my favorite tool as I love to do things on desktop and FTP client gives more control. Simply, use any free FTP client like FileZilla and login to your hosting FTP account and browse to root of your installation. You have to enable show hidden items to see Htaccess file, else it’s in hidden mode. Here is how you can enable it:

Under FileZilla Menu options> select server> Force showing hidden files


Now navigate to your root folder of your domain in my case it is and download your .htaccess file. Your .htaccess file will be at the root of the folder.



Make sure you take a back up of your .htaccess file before you starts editing it. You can use your OS default text editor to edit the file and once you have edited the file, simply re-upload it back. Make sure that permission of your .htaccess file is 644 and not 777.

In upcoming posts, I will be sharing couple of WordPress .htaccess hacks which will make your life easier. You might consider reading:

Do let us know if you still have questions regarding steps to edit WordPress .htaccess file, then do let me know. Do subscribe to our Email newsletter to receive more WordPress tutorials.

Subscribe on Youtube

Article By
Harsh Agrawal is a blog scientist and a passionate blogger. He is blogging since 2008 & writes about Blogging, SEO, Make money online & tech. His blog, ShoutMeLoud receives 1 million Pageviews/month and have over 700K subscribers.


COMMENTs ( 15 )

  1. says

    Hi i changed the wordpress permalink structure which is hosted in Ipage. Actually it is not updating automatically .htaccess file. In order to update the file i need to change the permissions for .htaccess can i do it..?
    Could you please let me know soon

  2. David says

    Hi Harsh,

    Something is changing my htaccess and make my site unavailable.

    In this example see how “RewriteRule ^index\.php$ – [L]RewriteCond %{REQUEST_FILENAME} !-f ” is on one line when is suppose to divide in two:

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    This is happening like one time a week. I have wordfence, stop spammers, bruteprotect and anti-malware. I can’t find anything that could be making does changes.

    Any ideas? Thanks!

  3. says

    Hi, I think my .htaccess file is hacked. I have All in One SEO pack and it shows .htaccess file but it looks right. Can you please tell me if there are hidden files in .htaccess file then where can I find them?

  4. Jupiter Jim says

    I want to change my permalink structure. Now I need to play with my .htaccess file. I never realized it was right there in my Yoast SEO plugin! Thanks so much for sharing this information. Critical stuff to know in the rare instances you need to modify the .htaccess file. Thanks for sharing!!!

  5. Sunil Prajapati says

    Hello Sir,
    I am Sunil Prajapati. As you wrote above, i did as well but my permalink yet not changed. It is now 404 error showing. Please tell me now what can i do…..

  6. Mukul Bansal says

    Installed Robot Meta Plugin and successfully edited my .htaccess file for my blog … Learned the other ways to update htaccess file on my blog … Thank you harsh for writing such a informative post

  7. altaf says

    respected all i ask a question on my site up-to 500 pages i read on google …..
    the google xml sitemap submit work only 500 pages but my website pages is over up to 500 what can i do kindly please giv me sudgession

  8. says

    I have tried your editing tips using your suggested code as written and it has shut my site down every time! What am I doing wrong?

  9. says

    Hi Harsh,

    I just screwed up with my .htaccess file… :( can you please help me?

    I was using %postname% as the permalink and recently i used one plugin (Page Links To) to change the permalink to redirect one of the pages in my website to a subdomain but it didn’t work due to some domain issue..but thats ok now I don’t want to link to subdomain. I just wanted the earlier permalink ( but what happens is get the 404 page not found error when i link to the earlier url. I tried changing the permalink multiple times…

    I think something would have got changed when i used the plugin. I have uninstalled the plugin and tried to access the page still the same error. But I can see the page in my wordpress admin page with the old url and when I click on ‘view page’ it gives 404 error.

    I have checked my .htaccess file and it seems there is a problem. Below is my .htaccess after the plugin was installed.

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    After going through different posts I have changed i to:

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress (Basically I removed the- — ‘RewriteRule ^index\.php$ – [L]’)

    But as per your post below is the .htaccess

    # BEGIN WordPress

    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    (I hope its for %postname% and not the default one) But its missing the
    (RewriteEngine On
    RewriteBase / ) and Includes
    ( RewriteRule ^index\.php$ – [L]) when compared to both the .htaccess what I have tried.

    I’m confused which one should I use out of all these three. I don’t remember what was my original .htaccess.. :( before all these goofups happen. But I was using %postname% permalink.

    I think you will be able to help out with this…I had gone through some of your posts and I feel you are expert in wordpress.
    I would really appreciate your help . I just want to my missing page should be appeared on the website as it was before with the old url (ie.
    Is this possible or do I need to republish the page with a different url as a new page and use 301 redirect? (But I don’t prefer 301 redirect..)
    Sorry that I have written too much but I hope you understand my issue. Looking forward to your reply. Thanks a lot

  10. Muhammad Usman says

    Thanks man it’s great info. I was searching for it but could not found anywhere finally i found it here. :)