HT: Difference between revisions

44 bytes removed ,  21 June 2013
Removed excess category tags; Additional grammar and cleanup edits.
(Updated link)
(Removed excess category tags; Additional grammar and cleanup edits.)
 
Line 27: Line 27:
<pre>http://www.anothersite.com/foo.ext or /foo.ext</pre>
<pre>http://www.anothersite.com/foo.ext or /foo.ext</pre>


===Server Generated URL Redirects===
===Server-Generated URL Redirects===
You moved or renamed a directory and you know people still have the old directory bookmarked so you want them to be redirected to the new directory, then you can use this code:  
You moved or renamed a directory and you know people still have the old directory bookmarked so you want them to be redirected to the new directory, then you can use this code:  
<pre>Redirect [Trigger] [New Destination]
<pre>Redirect [Trigger] [New Destination]
Line 34: Line 34:


===Limiting Access by Hostname/IP Address===
===Limiting Access by Hostname/IP Address===
Use this section of this article if you are intrested in blocking access to a file/folder on your server:  
Use this section of this article if you are interested in blocking access to a file/folder on your server:  
<pre>
<pre>
<Files admin.cgi>
<Files admin.cgi>
Line 41: Line 41:
  allow from 1.2.3.4  
  allow from 1.2.3.4  
</Files>
</Files>
</pre> This example denies access to admin.cgi to everyone but the owner of the IP Address mention in ''1.2.3.4''. You can also use this for a folder, in that case you would replace admin.cgi with the name of the folder. If you are intrested in using the Hostname rather than the IP then use:
</pre> This example denies access to admin.cgi for everyone but the user of the IP Address referred in ''1.2.3.4''. You can also use this for a folder; in that case you would replace admin.cgi with the name of the folder. If you are interested in using the Hostname rather than the IP then use:
<pre>
<pre>
<Files admin.cgi>
<Files admin.cgi>
Line 49: Line 49:
</Files>
</Files>
</pre>
</pre>
You can also use it for your whole network to have access to it alone, example:
You can also use it for your whole network to have access to it alone. Example:
<pre>
<pre>
# IP Number
# IP Number
Line 64: Line 64:
</Files>
</Files>
</pre>
</pre>
Where ''192.168.123'' is your internal network IP and .networkdomain.com is your Hostname/Domain. You can also switch it to allow from ALL and deny from a list of IPs or Hostnames.Here is a pratical example for advance users:
Where ''192.168.123'' is your internal network IP and .networkdomain.com is your Hostname/Domain. You can also switch it to allow from ALL and deny from a list of IPs or Hostnames. Here is a practical example for advanced users:
<pre>
<pre>
<Files [/path/filename]>
<Files [/path/filename]>
Line 72: Line 72:


===Limiting Access by User===
===Limiting Access by User===
This part lets you use a .htaccess/.htpasswd user login system which uses cookies. It is only partly secure because the session does not expire until all open browsers are closed, so try not to use it on a site section that needs fool-proof security. Here is the code:
This part shows the .htaccess/.htpasswd user login system which uses cookies. It is only partly secure because the session does not expire until all open browsers are closed, so do not use it on a site section that needs fool-proof security. Here is the code:
<pre>
<pre>
AuthType Basic
AuthType Basic
Line 79: Line 79:
Require valid-user
Require valid-user
</pre>
</pre>
For this example, you place a .htpasswd file in the path (/htpasswd/path/to/). In the .htpasswd file will be: <pre>[user]:[password]</pre> Normally you have to encrypt the password but if you are using [[The_Uniform_Server|The Uniform Server]], then you do not need to do that. You ca also use this example to protect another directory from just 1 .htaccess file:
For this example, you place a .htpasswd file in the path (/htpasswd/path/to/). In the .htpasswd file will be: <pre>[user]:[password]</pre> Normally you have to encrypt the password but if you are using [[The_Uniform_Server|The Uniform Server]], then you do not need to do that. You can also use this example to protect another directory by using just one .htaccess file:
<pre>
<pre>
<Directory /path/to/>
<Directory /path/to/>
Line 101: Line 101:
Or if you want to use it in groups then you can use:
Or if you want to use it in groups then you can use:
<pre>
<pre>
AuthGroupFile /htgorups/path/to/.htgroups
AuthGroupFile /htgroups/path/to/.htgroups
Require group groupname1 groupname2 groupname3...
Require group groupname1 groupname2 groupname3...
</pre>
</pre>
Line 112: Line 112:




[[Category: Troubleshooting ]]
[[Category: Apache Configuration]]
[[Category: Application]]
[[Category: Development]]