Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
.htaccess
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Common usage== ; [[Authorization]], [[authentication]]: A .htaccess file is often used to specify security restrictions for a directory, hence the filename "<kbd>access</kbd>". The <kbd>.htaccess</kbd> file is often accompanied by a <kbd>[[.htpasswd]]</kbd> file which stores valid [[username]]s and their [[password]]s.<ref>{{cite web | url = http://httpd.apache.org/docs/current/misc/password_encryptions.html | title = Apache Tutorial: Password Formats | access-date = 2009-03-02}}</ref> ; [[URL rewriting]]: Servers often use <kbd>.htaccess</kbd> for [[rewriting]] long, overly comprehensive URLs to shorter and more memorable ones. ; Blocking (access control): Use ''allow/deny'' to block users by IP address or domain. Also used to block bad bots, rippers and referrers. : ; SSI: Enable [[server-side include]]s. ; Directory listing: Control how the server will react when no specific web page is specified. ; [[Custom error page|Customized error responses]]: Changing the page that is shown when a server-side error occurs, for example [[HTTP 404|HTTP 404 Not Found]] or, to indicate to a search engine that a page has moved, [[HTTP 301|HTTP 301 Moved Permanently]].<ref>{{cite web | url = https://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633 | title = Webmaster Tools Help: 301 redirects | access-date = 2012-03-27}}</ref> ; [[MIME types]]: Instruct the server how to treat different varying file types. ; Cache control: <kbd>.htaccess</kbd> files allow a server to control [[web cache|caching]] by [[web browser]]s and [[caching proxy|proxies]] to speed up websites,<ref>{{Cite news|url=https://www.wpenlight.com/how-to-create-edit-wordpress-htaccess-speed-up-website/|title=How to Create and Edit WordPress htaccess File to Speed Up Your Website|date=2017-07-29|work=WP Enlight|access-date=2017-09-12|language=en-US|archive-date=2017-09-12|archive-url=https://web.archive.org/web/20170912192950/https://www.wpenlight.com/how-to-create-edit-wordpress-htaccess-speed-up-website/|url-status=dead}}</ref> reduce [[bandwidth (computing)|bandwidth]] usage, [[web server|server]] load, and perceived [[Latency (engineering)|lag]]. <kbd>.htaccess</kbd> also adds the cache age to the webpage resources so that on revisiting the page, the elements are reloaded from browser cache till the age mentioned expires, instead of requesting the resource again from the server. ; [[HTTPS]] & [[HTTP Strict Transport Security|HSTS]]: Implementation of both HTTPS and HSTS on Apache servers is largely dependent on correct [[URL rewriting]] & header information mentioned in <kbd>.htaccess</kbd> file. Any incorrect syntax in the file while deploying HTTPS or HSTS leads to a failure in implementation.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)