Connect with us

WordPress

What are the default WordPress htaccess settings?

Looking for the default WordPress .htaccess settings? If your .htaccess file is missing or corrupt, or you need to reset it, use this handy code.

Default WordPress .htaccess settings

Looking for the default WordPress htaccess settings?

Sometimes you need to set things back to basics. Maybe your WordPress site has been hacked and some mysterious lines have been added to your .htaccess file.

Whatever the reason, if you’re looking to reset your WordPress .htaccess file, located in the root folder of your WordPress install, copy and paste the code below.

Default WordPress htaccess

# BEGIN WordPress

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

# END WordPress

What does the .htaccess file do?

Essentially, it’s a set of instructions for file handling on a directory by directory basis.

If your webserver is Apache based, the .htaccess file will be used to handle configuration changes for files, folders, URL rewrites etc. For WordPress, it’s one of the reasons why your URLs look “pretty” as opposed to something like kenmcguire.ie/?p=1230835

You can learn more and find WordPress MU/Network versions on the Codex.

My .htaccess file is missing, what can I do?

If your WordPress .htaccess file has been deleted or removed from your WordPress folder entirely, there’s no need to panic.

Via FTP or your server’s control panel, you could log in and create a blank .htaccess file in the root of your WordPress install. Then visit Settings > Permalinks in the admin Dashboard and save changes to repopulate the file.

Alternatively, copy and paste the code above into a new file called “htaccess.txt”, transfer it to your server via FTP, and rename it to “.htaccess”.

Note that some FTP programmes will hide “dot” files by default. Make sure any settings that allow you to view invisible files have been enabled.

Broadcaster and sports writer at KCLR96FM; digital media head with a production eye on theatre, film and video; Read my Irish food blog, Ken On Food.

Click to comment

Got a comment or question? Have your say...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More in WordPress