Error

Default WordPress htaccess code [Updated]

You may be in a situation where you have issues with your WordPress website such as ‘Internal server error’ or maybe permalinks are not working or any other code might have messed up your htaccess file and you might have tried everything but couldn’t fix it.
Now you are trying to reset the WordPress .htaccess code with the default WordPress .htaccess code which is the last resort to fix the error in your website and you are on the right page to find the default .htaccess code of WordPress.

What is .htaccess file?

.htaccess is a configuration file used in web servers such as Apache and LiteSpeed to make your application of website properly depending upon what you are trying to achieve.
An improper htaccess code can break your website instantly and it is the thing you should avoid messing up.
It is also used for browser cache configuration and it is an important file even in cPanel/WHM when using multi-php version on your cPanel account.

What is the use of .htaccess file in WordPress?

WordPress is a CMS and it has many things pre-configured however links such as permalink of pages and posts are configured using .htaccess file.
A broken .htaccess code can take your website post and pages down and you may only be able to browse the homepage of the website.
It will also break images that are very important in your website and make your website look broken.
It will also affect your rankings as Google and other search engines will consider your website down which will eventually decrease your website rankings.

What is the location of .htaccess file in WordPress?

The default location of .htaccess file is inside public_html and/or in the main folder of your website files.
If you are not able to find the .htaccess file, it might be hidden(if using cPanel) or it may not be present.
You should make hidden files visible if you are using cPanel by going in File manager > Settings(top right) > check box of ‘Show hidden files and Save it.

Default WordPress htaccess code

Below is the default .htaccess code for WordPress which you can copy-paste in your .htaccess file. Easily replace your htaccess code

# BEGIN WordPress

RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /
RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

You can find more .htaccess files from the official website if the above code did not work for you:
https://wordpress.org/support/article/htaccess/

 

If you are facing issues even after resetting htaccess code, comment below and we’ll try to find a solution for you

Sufiyan Shaikh

Recent Posts

CyberPanel Server Error (500)

Server Error (500) when trying to access the Cyberpanel If you are getting this error while accessing the cyberpanel, there…

1 year ago

How to connect and use github with DirectAdmin git feature

How to connect git with DirectAdmin Login into SSH and run the following command to create a new key pair…

1 year ago

How to host next js app on cpanel

How to host next js app in cpanel Login > Setup Node.js App > Create Application Enter the values shown…

1 year ago

WHMCS Development environment set

Update via PHPMYADMIN: Disable Captcha : UPDATE tblconfiguration SET value = '' WHERE setting = 'CaptchaSetting'; Update WHMCS link: UPDATE…

1 year ago

Lagom WHMCS notification hide pages list

3dsecure Access Denied Affiliates Affiliates Signup Announcements Banned Configure Products Downloads Downloads Denied Error Login Logout Password Reset Ticket Feedback…

1 year ago

Export/Import database via command line(ssh)

Export Database via SSH mysqldump --routines -u databaseusername -p databasename > database.sql   Import Database via SSH mysql -u databaseusername…

1 year ago