ShoutMeLoud – Shouters Who Inspire

Superlinks
≡ Menu

How to Edit WordPress .htaccess File

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.

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 specially, 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.

cPanel File Manager

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.

Editing .Htaccess from cPanel

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.

WordPress Dashboard htaccess Editing

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 shoutmeloud.com 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.

  • Author Bio

  • Latest Post

Article by Harsh Agrawal

Harsh has written 1062 articles.

If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.


{ 9 comments… add one }

  • Jupiter Jim

    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!!!

    Reply
  • Sunil Prajapati

    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…..

    Reply
  • Mukul Bansal

    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

    Reply
  • altaf

    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

    Reply
  • Steve B

    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?

    Reply
    • Harsh Agrawal

      @Steve
      Are you using FTP method? Can you share the code which you are adding, usually it happens when code is wrong in .htaccess file.

      Reply
      • steve b

        I finally got it! I don’t know what the problem was though. Thanks

        Reply
  • Anson

    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 (mydomain.com/%postname%) 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. Mydomain.com/%postname%)
    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

    Reply
  • Muhammad Usman

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

    Reply

Leave a Comment