User Tools

Site Tools


htaccess_recipes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
htaccess_recipes [2021/04/05 07:15] – [Recipes] hc9htaccess_recipes [2022/02/13 20:59] – changed to internal DokuWiki link jquah
Line 1: Line 1:
 ====== .htaccess recipes ====== ====== .htaccess recipes ======
 +
 +=== Introduction ===
  
 .htaccess is the default file used by the [[http://httpd.apache.org/|Apache HTTP server]] (and others) in order to allow dynamic configuration. It's a plain text file that uses the same syntax present in the main configuration files (e.g., httpd.conf). It can contain a subset of Apache directives. The size of this subset depends on wheter the directives can be overridden or not (and this is present in the server configuration). In the Apache documentation you can see if a directive can be placed in a .htaccess file by checking that in the Context: line appears .htaccess. For instance, it's possible for the [[http://httpd.apache.org/docs/2.2/mod/core.html#forcetype|ForceType]] directive, but it's not for the  [[http://httpd.apache.org/docs/2.2/mod/core.html#errorlog|ErrorLog]] directive. file. .htaccess is the default file used by the [[http://httpd.apache.org/|Apache HTTP server]] (and others) in order to allow dynamic configuration. It's a plain text file that uses the same syntax present in the main configuration files (e.g., httpd.conf). It can contain a subset of Apache directives. The size of this subset depends on wheter the directives can be overridden or not (and this is present in the server configuration). In the Apache documentation you can see if a directive can be placed in a .htaccess file by checking that in the Context: line appears .htaccess. For instance, it's possible for the [[http://httpd.apache.org/docs/2.2/mod/core.html#forcetype|ForceType]] directive, but it's not for the  [[http://httpd.apache.org/docs/2.2/mod/core.html#errorlog|ErrorLog]] directive. file.
Line 15: Line 17:
 OK, let's see some recipes. The URL http://YOURUSERNAME.freeshell.org/ will be used in the examples, so modify it to suit your needs and remember that your .htaccess file will be placed in $HOME/html/ or in directories under it. Examples solve a specific issue, but they can give you an idea on how to deal with something more generic (i.e., an example could be referred to .pl files, but with a search of the mentioned directives you could generalize it). If you need some help, jump on com or post your request on bboard. OK, let's see some recipes. The URL http://YOURUSERNAME.freeshell.org/ will be used in the examples, so modify it to suit your needs and remember that your .htaccess file will be placed in $HOME/html/ or in directories under it. Examples solve a specific issue, but they can give you an idea on how to deal with something more generic (i.e., an example could be referred to .pl files, but with a search of the mentioned directives you could generalize it). If you need some help, jump on com or post your request on bboard.
  
 +
 +====== Recipes ======
  
 ===== Redirect to a custom error page ===== ===== Redirect to a custom error page =====
  
-Do you want your visitors see your custom error pages when something goes wrong (e.g., a page not found error)? There's already a tutorial about it: http://sdf.org/index.cgi?tutorials/errorpage+Do you want your visitors see your custom error pages when something goes wrong (e.g., a page not found error)? There's already a tutorial about it: [[custom_error_pages_for_your_site|custom error pages for your site]]
  
 ===== Deny directory listing ===== ===== Deny directory listing =====
htaccess_recipes.txt · Last modified: 2022/08/01 20:35 by peteyboy