Maneza F8
Maneza F8

Reputation: 35

What is the right way to add .htaccess file in wordpress website?

I am thinking of adding the .htaccess file in my website which is a wordpress website, according to my research it can optimize the speed of the website by disabling the hotlinking and other stuff.

I want to add it but I am not so sure because I know it from other websites I worked with it can come with errors and I don't understand how wordpress communicate with .htaccess file.

this is the code that i want to add.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?sparringmind.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/sparringmind [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]


Wordpress can be trick after adding this file it can trigger more errors and cause me a headache.. I want to know if with this code alone is it safe for me to just add that file on my root file and hope it will just do the job or there are some more configurations I need to run?

Thanks

Upvotes: 1

Views: 118

Answers (1)

Reggie Te
Reggie Te

Reputation: 76

try the following steps

  1. Enable View hidden files on the server
  2. Navigate to the public_html
  3. Back-up the current .htaccess
  4. Import new settings

Troubleshooting

  • 304 Forbidden - check permissions
  • For other issues check the error_log on the server

Upvotes: 1

Related Questions