Home | Jesus | ActionScript | AS3Dmod | CSS | Favicon | FLARToolKit | .htaccess | HTML | JigLibFlash | Papervision3D | SketchUp | Unity
.htaccess
.htaccess
.htaccess, or hypertext access, is a file that allows directory-level configuration changes.
Changes by this file apply to the directory where it is located and all subdirectories. It does not have a file name, only a file extension. The leading dot designates it as a hidden file.
Instructions
- Open Notepad
- Copy and paste code below
- Click File
- Click Save As...
- After File name:, type .htaccess
- After Save as type:, select All Files
- Click Save
- Upload .htaccess to root directory of your website
www to non-www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^w+\.(domain\.com)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]
| From: | www.domain.com |
|---|---|
| w.domain.com | |
| ...ww.domain.com | |
| To: | domain.com |
non-www to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
| From: | domain.com |
|---|---|
| To: | www.domain.com |
Key
Options - options
+FollowSymLinks - follow symbolic links
RewriteEngine - rewrite engine
on - on
RewriteCond - rewrite condition
RewriteRule - rewrite rule
%{HTTP_HOST} - host
^ - start of string
$ - end of string
() - group
%N - backreference to rewrite condition group (1<=N<=9)
$N - backreference to rewrite rule group (0<=N<=9)
. - any character
? - matches previous character zero or one time
* - matches previous character zero or more times
+ - matches previous character one or more times
\ - escape (treat special characters as normal characters)
[L] - last
[NC] - no case (case insensitive)
[R] - temporary redirect
[R=301] - permanent redirect
