.htaccess
definition:
Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. These .
htaccess
files enable the localized fine-tuning of Apache’s universal system-configuration directives, which are defined in Apache’s main configuration file. The localized .
htaccess
directives must operate from within a file named .
htaccess
. The user must have appropriate file permissions to access and/or edit the .
htaccess
file. Further, .
htaccess
file permissions should never allow world write access — a secure permissions setting is “644â€, which allows universal read access and user-only write access. Finally, .
htaccess
rules apply to the parent directory and all subdirectories. Thus to apply configuration rules to an entire website, place the .
htaccess
file in the root directory of the site.
Comments on .htaccess
code
Comments are essential to maintaining control over any involved portion of code. Comments in .
htaccess
code are fashioned on a per-line basis, with each line of comments beginning with a pound sign #
. Thus, comments spanning multiple lines in the .
htaccess
file require multiple pound signs. Further, due to the extremely volatile nature of htaccess voodoo, it is wise to include only alphanumeric characters (and perhaps a few dashes and underscores) in any .
htaccess
comments.
Important Notes for .htaccess Noobs [ ^ ]
As a configuration file, .
htaccess
is very powerful. Even the slightest syntax error (like a missing space) can result in severe server malfunction. Thus it is crucial to make backup copies of everything related to your site (including any original .
htaccess
files) before working with your Hypertext Access file(s). It is also important to check your entire website thoroughly after making any changes to your .
htaccess
file. If any errors or other problems are encountered, employ your backups immediately to restore original functionality.
Performance Issues [ ^ ]
.
htaccess
directives provide directory-level configuration without requiring access to Apache’s main server cofiguration file (httpd.conf). However, due to performance and security concerns, the main configuration file should always be used for server directives whenever possible. For example, when a server is configured to process .
htaccess
directives, Apache must search every directory within the domain and load any and all .
htaccess
files upon every document request. This results in increased page processing time and thus decreases performance. Such a performance hit may be unnoticeable for sites with light traffic, but becomes a more serious issue for more popular websites. Therefore, .
htaccess
files should only be used when the main server configuration file is inaccessible. See the “Performance Tricks†section of this article for more information.
Regex Character Definitions for htaccess2 [ ^ ]
#
#
instructs the server to ignore the line. used for including comments. each line of comments requires it’s own #
. when including comments, it is good practice to use only letters, numbers, dashes, and underscores. this practice will help eliminate/avoid potential server parsing errors.[F]
403 Forbidden
to the client.[L]
[N]
[G]
Gone (no longer exists)
status message.[P]
mod_proxy
[C]
[R]
[NC]
[PT]
mod_rewrite
to pass the rewritten URL back to Apache for further processing.[OR]
[NE]
[NS]
[QSA]
[S=x]
[E=variable:value]
[T=MIME-type]
[]
[]+
[^]
[a-z]
a{n}
n
, of the preceding character. e.g., x{3} matches exactly three x
’s.a{n,}
n
or more of the preceding character. e.g., x{3,} matches three or more x
’s.a{n,m}
n
and m
, of the preceding character. e.g., x{3,7} matches three, four, five, six, or seven x
’s.()
^
$
?
monzas?
will match monza or monzas, while mon(za)?
will match either mon or monza. i.e., x?
matches zero or one of x
.!
!string
†matches everything except “string
â€..
-
...domain.com.* - [F]
â€.+
G+
matches one or more G’s, while “+” will match one or more characters of any kind.*
.*
†as a wildcard.|
(x|y)
matches x
or y
.\
^ $ ! . * |
). e.g., use “\.
†to indicate/escape a literal dot.\.
/*
.*
^$
^.*$
[^/.]
[^/.]+
http://
^domain.*
domain
â€, which then may be proceeded by any number of any characters.^domain\.com$
domain.com
â€.-d
-f
-s
Redirection Header Codes [ ^ ]
Dobby and Luna have been part of our lives for the past years. They have…
In the year 2021, I've completed some paid projects. Some of them are more technical,…
Based on the GlassTime Bootstrap template, here I present glassmorphism WordPress Theme free to download.This…
This HTML5 template is using Glassmorphism UI design language which is now trending for 2021…
KecamatanKode POSBanjar81152Buleleng81119Busungbiu81154Gerokgak81155Kubutambahan81172Sawan81171Seririt81153Sukasada81161Tejakula81173Klik pada nama kecamatan untuk melihat daftar desa masing-masing. Sumber: kodepos.andiim3.com
Ada yang bilang "semuanya akan mati matic pada akhirnya". Bener aja, sekarang tuntutan transportasi sehari-hari…
This website uses cookies.