The .htaccess is a server configuration file allowing setting up the details of the website without changing the config folder. The file is present in WordPress themes along with all Apache web hosting and can be used for your web page performance, safety, and user-friendliness improve. It can be found in your WP site root directory. All you must do is to link the file to the website with the help of an FTP client so that it can be edited.
By employing .htaccess files, you will get the following features that can be either enabled or disabled on your own: server signature, URL forwarding, file caching, password security and custom mistake pages. The files mentioned above set up and operate so-called server farms where web hosting users utilize the same Apache server. Without .htaccess files, the virtual hosting indicates that every client of the similar segment should use identically the same settings.
Thus, web hosts such as GoDaddy, DreamHost, MediaTemple, etc. enable .htaccess files. When they are enabled, the web page becomes faster than any others.
Creating a.htaccess file is quite easy if you know how. It can be created using any preferable text editor or directly in cPanel. To begin, open an empty text file and save it as shown below:
‘.htaccess’
In case your server does not let you do this, you may save the file named ‘htaccess.txt’ and rename it to the appropriate one when it is applied to your site. Then include the following default code in the file, save the adjustments and submit the file to your WordPress root folder with the help of FTP client:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Make sure that there is no gap between lines when pasting the code into the .htaccess file. The code must look like presented below:
We also recommend that you set up a website permit of 644, so it will be protected from possible assaults. To understand the purpose of this file permission, read the article .
Here we will cover some helpful tricks for WP that can be tried in practice.
You may find more useful .htaccess tricks for your WordPress site with the fullest description here .
We have tried to cover some of the most crucial questions referring to a successful and productive work with .htaccess files in your WP website and hope that our article has helped you understand their principles better. We will be happy if you decide to share your user experience with us in the future.
Developers of WordPress Dashboard made it possible to generate such files automatically. IT is pretty easy to do. In Settings, there is a Permalinks button. Click on and after that simply save the changes you have implemented. And voila you have a WordPress default .htaccess file in a website's’ root. Moreover, there are few editors ready to help you change .htaccess file fast.
But it is wise to know the ways to edit everything manually. Including default .htaccess generation. There are two ways: you can create such a file on a computer or on a server. A text editor is the easiest way to generate such files on a PC. Let’s create a .txt file named htaccess.txt. Then open it and do the coding you required for implementing additional commands. Then copy-paste created file to the root. Just remember to change the file’s extension to .htaccess.
You need even fewer steps when you need to generate a .htaccess file directly on a server. At first, go to the directory (or subdirectory) where your .htaccess file will locate. Open the drop-down menu with RMB and create a new file with .htaccess extension. Then edit it as you wish with a Notepad++ for example.
Here we have to make a little note. Keep in mind that manual editing and generation of .htaccess files can be risky. It can ruin your website and after that, it may take time to restore the previous version. So remember to make a few things when you work with .htaccess file.
Snippets are an important part of .htaccess file editing. These reusable code parts can make your life really easy and enrich your website functional if you know how to use them.
You can find many of them online. For example, on a GitHub or CSS-tricks. So let’s check some of them out and find out what they can do with your website.
So, at first, we must find a .htaccess file. Go to the root directory and open it. If the installation was successful then you wills this code:
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # WordPress
Now you can add new code or snippers into this default .htaccess file.
The default settings of the server allow you to browse the website’s directory. But it may lead to some security risks. It looks like this:
And if you want to eliminate this threat than use this code:
# Désactivate the display of contents of rédirectories Options All -Indexes
The result will look like:
The same risks may push you to hide information about your server. It can be done with next snipper:
# Mask the information of server ServerSignature Off
When your server is abroad it may have some troubles with time settings. And you can change them with:
# set the server timezone SetEnv TZ America/Washington
And the last snipper is restricting access to your .htaccess file.
It looks like this:
# Restrict access to htaccess <files ~ "^.*\.([Hh][Tt][Aa])"> order allow,deny deny from all satisfy all </files>
For some hackers, it is also possible to burn down your bandwidth by hotlinking on the image on your website. It creates risks for your website optimization, and we all know that web search algorithms prefer fast websites. It may harm your SEO function.
This snipper can help you avoid such issues:
#Stop hotlinkers in their tracks RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yoursite.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/yoursite [NC] RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
It is also important how to ban the IP address
It is very useful if there are issues with spam commenters or some suspicious activity on your website.
#Ban Spammers and bots by blacklisting IP addresses <Limit GET POST> order allow,deny deny from xxx.xxx.xx.x deny from xxx.xxx.xx.x deny from xxx.xxx.xx.x deny from xxx.xxx.xx.x deny from xxx.xxx.xx.x allow from all </Limit>
It is a place where most of your customization stores. Here you write posts, do menu configurations, customize your theme and so on.
And it is obvious that you want to limit access to your website administration. In order to do so, you can list IPs that may get access to the admin area.
<Limit GET POST PUT> order deny,allow deny from all allow from xx.xx.xx.xx //( your static IP) allow from xx.xx.xx.xx //( Whitelist IP) allow from xx.xx.xx.xx //( Whitelist IP) allow from xx.xx.xx.xx //( Whitelist IP) allow from xx.xx.xx.xx //( Whitelist IP) allow from xx.xx.xx.xx //( Whitelist IP) </Limit>
With this snippet, you can limit direct access to files with a .PHP extension.
<Files wp-tinymce.php> allow Aallow from all </Files> <FilesMatch "\.(?i:php)$"> <IfModule !mod_authz_core.c> Order allow,deny Deny from all </IfModule> <IfModule mod_authz_core.c> Require all denied </IfModule> :</FilesMatch> <Files wp-tinymce.php> Allow from all </Files> <Files ms-files.php> Allow from all </Files>
This codding product allows us to use only selected files from the wp-content subdirectory. In a few words, it denies entry to stored files. In addition, it will allow you to selectively unblock various types of files.
# Disable access to all file types except the following Order deny,allow Deny from all <Files ~ ".(xml|css|js|jpe?g|png|gif|pdf|docx|rtf|odf|zip|rar)$"> Allow from all </Files>
Useful .htaccess Snippets Collection. 15 Tricks to Take Better Control of Your Site
Guide to Keep Your WordPress Theme and Plugin Code Secure
Best Customer Service and Chat Plugins for WordPress 2020
Brand New Solution to Attract Home Customers: Real Estate Agency WordPress Theme
Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.
It’s great that you are getting ideas from this post as well as from our dialogue made at this place.
This is the perfect blog for everyone who wishes to find out about
this topic. You know so much its almost tough to argue with
you (not that I really would want to…HaHa). You definitely
put a fresh spin on a subject that has been written about for
many years. Wonderful stuff, just great!
This design is spectacular! You obviously know how to keep a reader entertained.
Between your wit and your videos, I was almost moved to start my own blog (well,
almost…HaHa!) Fantastic job. I really enjoyed what you had to say, and more than that,
how you presented it. Too cool!
It’s actually very complex in this full of activity life to listen news on TV, thus
I simply use web for that purpose, and obtain the hottest news.
Outstanding story there. What occurred after? Take care!
I read this piece of writing fully concerning the resemblance of newest and previous technologies,
it’s remarkable article.
Simply wish to say your article is as amazing.
The clarity in your post is simply spectacular and i can assume you’re an expert on this subject.
Fine with your permission allow me to grab your RSS feed to keep up to date
with forthcoming post. Thanks a million and please carry on the enjoyable
work.
Hurrah, that’s what I was searching for, what a
data! existing here at this blog, thanks admin of this website.
After exploring a handful of the blog posts on your blog, I
seriously appreciate your way of writing a blog.
I bookmarked it to my bookmark webpage list and will be checking back in the
near future. Take a look at my web site too and tell me how you feel.
Asking questions are really good thing if you are not understanding something entirely, but this piece of writing provides good understanding even.
Heya i am for the first time here. I found this
board and I find It truly useful & it helped me out a lot.
I hope to give something back and aid others like you helped me.
It is not my first time to go to see this web site, i am visiting this web page dailly and obtain pleasant data
from here everyday.
I like the valuable info you provide in your articles.
I will bookmark your weblog and check again here frequently.
I am quite certain I will learn many new stuff right here!
Good luck for the next!
Hi it’s me, I am also visiting this website regularly, this web site
is really good and the users are really sharing pleasant thoughts.
Excellent post. I was checking constantly this blog and I’m inspired!
Extremely useful info specially the ultimate section 🙂 I maintain such information much.
I was looking for this certain info for a long time.
Thank you and best of luck.
Everything is very open with a really clear clarification of the challenges.
It was really informative. Your website is extremely helpful.
Thanks for sharing!
After going over a number of the blog articles on your web page, I really like
your technique of blogging. I saved it to my bookmark webpage list and will be checking back soon. Please check out my web site as well and let
me know what you think.
Wow, this post is good, my sister is analyzing these kinds of
things, thus I am going to inform her.
Can you tell us more about this? I’d care to find out more details.
I blog quite often and I seriously appreciate
your information. This great article has really peaked my interest.
I am going to bookmark your site and keep checking for new information about once per week.
I subscribed to your RSS feed too.
I am really inspired with your writing abilities as neatly as with the format for your blog.
Is that this a paid subject matter or did you modify it yourself?
Either way stay up the excellent quality writing, it’s rare to see
a nice blog like this one today..
It’s in reality a great and useful piece of info. I am
happy that you just shared this helpful info with us.
Please keep us up to date like this. Thanks for sharing.
What’s Going down i am new to this, I stumbled upon this
I’ve discovered It absolutely helpful and it has helped
me out loads. I hope to contribute & assist different customers like its aided me.
Good job.
For latest information you have to go to see web and on world-wide-web I found this
site as a finest site for newest updates.
Hey There. I found your blog using msn. This is a really well
written article. I will be sure to bookmark it and return to read more of your useful
info. Thanks for the post. I’ll definitely comeback.
You made some good points there. I checked on the web for more information about the issue and
found most people will go along with your views on this website.
When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is
added I get four emails with the same comment. Is there any way you can remove me from
that service? Bless you!
Great weblog right here! Additionally your web site a
lot up fast! What host are you the usage of?
Can I get your associate hyperlink in your host?
I wish my website loaded up as quickly as yours lol
Thanks for the auspicious writeup. It actually was once a entertainment account it.
Glance complex to far introduced agreeable from you! However,
how can we keep in touch?
Greetings I am so excited I found your blog page, I really found you by accident, while I was searching on Google for something
else, Regardless I am here now and would just like
to say cheers for a marvelous post and a all round thrilling blog (I also love the theme/design), I don’t have time to
look over it all at the moment but I have bookmarked it
and also added your RSS feeds, so when I have time I will be back to read more,
Please do keep up the fantastic b.
Very good article. I definitely appreciate this site. Keep writing!
Hey! I just wanted to ask if you ever have any problems with
hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard
work due to no backup. Do you have any solutions to protect against hackers?
Ahaa, its nice discussion about this post at this
place at this web site, I have read all that, so now me also
commenting here.
That is really fascinating, You’re an excessively professional blogger.
I have joined your feed and look forward to looking for extra of your magnificent post.
Also, I have shared your website in my social networks
I visit daily some web pages and blogs to read articles,
except this blog offers feature based articles.
Excellent goods from you, man. I’ve take into accout your stuff prior to and
you are just extremely magnificent. I really like what you’ve got right here,
certainly like what you are saying and the way during which
you are saying it. You make it enjoyable and you still take care
of to keep it wise. I cant wait to read far more from you.
That is really a terrific web site.
Thanks for sharing such a fastidious thought, post is good, thats why
i have read it fully
Hi there Dear, are you genuinely visiting this website daily, if so
then you will definitely obtain pleasant know-how.
Wow, superb blog layout! How long have you been blogging for?
you make blogging look easy. The overall
look of your site is wonderful, let alone the content!
Hey! Quick question that’s totally off topic.
Do you know how to make your site mobile friendly?
My site looks weird when viewing from my iphone 4. I’m trying to find
a theme or plugin that might be able to resolve this problem.
If you have any suggestions, please share. Cheers!
Oh my goodness! Impressive article dude! Thank you so much, However I am encountering issues with your RSS.
I don’t know the reason why I can’t join it. Is there anybody having similar RSS
problems? Anyone that knows the answer can you kindly respond?
Thanx!!
Pretty! This was a really wonderful post. Many thanks for supplying this info.
Greetings! This is my first visit to your blog! We are a
group of volunteers and starting a new project in a community in the same niche.
Your blog provided us beneficial information to
work on. You have done a outstanding job!
Keep on working, great job!
I enjoy what you guys tend to be up too. This sort of clever work and coverage!
Keep up the good works guys I’ve added you guys to my blogroll.
An outstanding share! I have just forwarded this
onto a co-worker who was doing a little research on this. And
he actually bought me dinner due to the fact that I discovered
it for him… lol. So allow me to reword this….
Thank YOU for the meal!! But yeah, thanx for spending time to discuss this topic
here on your web site.
This is a really good tip especially to those fresh to the blogosphere.
Short but very accurate information… Thanks
for sharing this one. A must read post!
This is my first time visit at here and i am truly pleassant to read everthing at single place.
It’s perfect time to make some plans for the future and it’s time
to be happy. I’ve read this post and if I could I wish to suggest you few interesting things or advice.
Maybe you can write next articles referring to this article.
I wish to read more things about it!
magnificent points altogether, you just won a new reader.
What might you suggest in regards to your publish that you made a
few days ago? Any certain?
Wow! At last I got a website from where I be able to genuinely get useful facts concerning my study and knowledge.
First off I would like to say great blog!
I had a quick question in which I’d like to
ask if you don’t mind. I was interested to find out how you center yourself
and clear your mind prior to writing. I’ve had trouble clearing
my mind in getting my ideas out there. I do enjoy writing however it
just seems like the first 10 to 15 minutes are usually wasted just
trying to figure out how to begin. Any suggestions or tips?
Cheers!
I like the helpful information you supply on your
articles. I’ll bookmark your blog and check again right here regularly.
I am reasonably certain I’ll be told many new stuff
proper here! Good luck for the next!
Does your website have a contact page? I’m having trouble
locating it but, I’d like to send you an e-mail.
I’ve got some recommendations for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it expand over time.
Heya! I just wanted to ask if you ever have any trouble with
hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data
backup. Do you have any solutions to prevent hackers?
My brother recommended I might like this blog. He was entirely right.
This post actually made my day. You can not imagine just
how much time I had spent for this info! Thanks!
Informative article, just what I wanted to find.
It is in reality a nice and helpful piece of info. I am happy that you just shared this helpful information with us.
Please stay us informed like this. Thank you for
sharing.
I’m gone to convey my little brother, that he should also visit this
blog on regular basis to take updated from most
recent information.
Hi there, this weekend is nice in support of me, as this moment i am reading this wonderful informative paragraph here at
my house.
I like the valuable info you provide in your
articles. I will bookmark your weblog and check again here regularly.
I am quite certain I’ll learn lots of new stuff right here!
Best of luck for the next!
Hello i am kavin, its my first time to commenting anywhere, when i read this piece of writing i thought
i could also create comment due to this good post.
Keep this going please, great job!
It’s amazing in support of me to have a web
page, which is good in favor of my know-how. thanks admin
Informative article, exactly what I needed.
Hi to every one, since I am genuinely eager of reading this weblog’s
post to be updated regularly. It carries fastidious material.
Hey! I could have sworn I’ve been to this site before
but after browsing through some of the post I realized it’s new
to me. Nonetheless, I’m definitely happy I found it and
I’ll be book-marking and checking back frequently!
This web site certainly has all of the information and facts I needed concerning this subject and didn’t know who
to ask.
Great post however I was wanting to know if you could write a
litte more on this topic? I’d be very grateful if you could elaborate a little bit
more. Cheers!
Magnificent beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog website?
The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided
bright clear concept
Heya are using WordPress for your site platform? I’m
new to the blog world but I’m trying to get
started and create my own. Do you require any html coding expertise to make
your own blog? Any help would be really appreciated!
I don’t even know how I ended up here, but I thought this post was great.
I do not know who you are but certainly you’re going to a
famous blogger if you aren’t already 😉 Cheers!
This design is spectacular! You obviously know how to keep a reader amused.
Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
I really enjoyed what you had to say, and more than that, how you presented it.
Too cool!
Superb blog you have here but I was curious about if you knew of any discussion boards that cover the same topics talked about here?
I’d really like to be a part of community where I can get feedback from other knowledgeable
individuals that share the same interest. If you have any recommendations, please
let me know. Many thanks!
I’m not sure exactly why but this site is loading very
slow for me. Is anyone else having this problem or
is it a issue on my end? I’ll check back later on and see
if the problem still exists.
What i don’t realize is actually how you’re no longer
really a lot more smartly-liked than you may be now. You’re so intelligent.
You understand therefore significantly when it comes to this topic,
produced me personally believe it from so many numerous angles.
Its like men and women aren’t involved until it’s something to do with Lady gaga!
Your own stuffs nice. At all times maintain it up!
We’re a group of volunteers and opening a new scheme in our community.
Your site provided us with valuable info to work on. You’ve performed an impressive activity and our
whole community shall be grateful to you.
Nice answers in return of this query with genuine arguments and describing everything concerning
that.
Great post but I was wondering if you could write a
litte more on this topic? I’d be very grateful if you could elaborate a little bit more.
Appreciate it!
Very rapidly this site will be famous amid all blog visitors, due to it’s fastidious articles
I have read so many content on the topic of the blogger lovers except this article is actually a pleasant paragraph, keep it up.
It’s really a nice and useful piece of information. I am happy that you shared this useful information with us.
Please keep us informed like this. Thank you for sharing.
Heya i am for the primary time here. I found this board
and I to find It really helpful & it helped me out a lot.
I am hoping to present one thing again and aid others like
you helped me.
I really like what you guys are up too. Such clever work and exposure!
Keep up the amazing works guys I’ve added you guys to blogroll.
Do you mind if I quote a couple of your articles as long as I provide credit and sources back to
your blog? My website is in the very same area of interest as yours and
my visitors would genuinely benefit from some of the information you provide here.
Please let me know if this alright with you.
Regards!
Very soon this site will be famous among all blogging and site-building visitors, due to it’s good content
Link exchange is nothing else however it is only placing the other
person’s weblog link on your page at proper place and other person will also do similar in favor of you.
Hello there! I could have sworn I’ve been to this blog
before but after browsing through many of the posts I
realized it’s new to me. Regardless, I’m definitely pleased I found it and I’ll be
book-marking it and checking back regularly!
I go to see every day some web pages and websites to read posts, however this web site offers feature based writing.
I do not know whether it’s just me or if everybody else experiencing problems with your site.
It appears as if some of the text in your content are running off the
screen. Can somebody else please provide feedback and let
me know if this is happening to them as well? This could
be a problem with my internet browser because I’ve had
this happen before. Appreciate it
I am sure this paragraph has touched all the internet
people, its really really pleasant piece of
writing on building up new blog.
Greetings from Idaho! I’m bored at work so I decided
to check out your site on my iphone during lunch break.
I love the info you present here and can’t wait to take a look when I get home.
I’m amazed at how fast your blog loaded on my cell
phone .. I’m not even using WIFI, just 3G .. Anyhow, amazing blog!
Unquestionably believe that which you stated. Your favourite justification appeared to be at the internet the simplest thing to remember of.
I say to you, I definitely get annoyed while people think about issues that they plainly do not recognise about.
You controlled to hit the nail upon the highest as smartly as outlined out the whole thing without having side effect , people can take a signal.
Will likely be again to get more. Thank you
Right here is the right website for anyone who wishes to understand this topic.
You know so much its almost tough to argue with you (not that I really will need to…HaHa).
You definitely put a new spin on a topic which has been written about for
decades. Excellent stuff, just excellent!
What’s up, this weekend is pleasant designed for me,
since this point in time i am reading this great educational piece of writing here
at my home.
I seriously love your blog.. Excellent colors & theme.
Did you build this amazing site yourself? Please reply back as I’m
attempting to create my own personal site and would like to learn where you got this from or exactly
what the theme is called. Many thanks!
Its like you read my mind! You seem to understand so much
about this, such as you wrote the ebook in it or something.
I believe that you simply can do with a few percent to power the
message house a little bit, but instead of that, this is excellent blog.
A great read. I’ll certainly be back.
Hello there, just became aware of your blog through Google, and found that it is really informative.
I’m gonna watch out for brussels. I will appreciate if you continue
this in future. Lots of people will be benefited from your writing.
Cheers!
Great beat ! I wish to apprentice while you amend your website, how
can i subscribe for a blog website? The account aided me a acceptable deal.
I had been tiny bit acquainted of this your broadcast offered bright
clear idea
I couldn’t refrain from commenting. Exceptionally well written!
I read this paragraph completely about the difference of newest
and earlier technologies, it’s amazing article.
This article gives clear idea designed for the new people of blogging, that genuinely
how to do blogging and site-building.
It’s awesome to pay a quick visit this web site and
reading the views of all mates on the topic of this paragraph, while
I am also keen of getting familiarity.
Great post. I was checking continuously this blog and I am
inspired! Extremely useful info specially the final phase 🙂 I deal with such
info much. I was looking for this particular info for a very lengthy time.
Thank you and best of luck.
Usually I do not learn post on blogs, but I wish to say that
this write-up very pressured me to check out and do so!
Your writing style has been amazed me. Thank you, quite great article.
Neat blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple adjustements would really make my blog stand out.
Please let me know where you got your theme. Thanks a lot
Hi! I understand this is sort of off-topic however I needed to ask.
Does building a well-established blog like yours require a lot of work?
I’m completely new to running a blog but I do write in my journal on a daily basis.
I’d like to start a blog so I will be able to share my experience
and views online. Please let me know if you have any kind of suggestions or
tips for new aspiring blog owners. Thankyou!
great idia , thankb for share this informations,
thank a lots