Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
litespeed_wiki:config:autoindex [2018/11/05 19:03]
Jackson Zhang
litespeed_wiki:config:autoindex [2018/11/05 20:37]
Lisa Clarke Proofreading
Line 1: Line 1:
 ====== How to Customize Auto Index Script ====== ====== How to Customize Auto Index Script ======
  
-The LiteSpeed ​web server ​supports automatic directory indexing when an index file is not present in a directory. It uses an external script to generate the index page on the fly. This provides you with maximum flexibility when creating the look and feel of your auto index page.  You can also customize your index page at a global level, ​or for each natively configured virtual host,  or Apache vhost on a control panel environment. ​+LiteSpeed ​Web Server ​supports automatic directory indexing when an index file is not present in a directory. It uses an external script to generate the index page on the fly. This provides you with maximum flexibility when creating the look and feel of your auto index page.  You can also customize your index page at a global level, for each natively configured virtual host, or Apache vhost in a control panel environment. ​
  
-===== How LSWS implements auto index =====+===== How LSWS Implements Auto Index =====
 The default script paired with the installation package is a PHP script. However, you can create your own script using any language you like. The default script paired with the installation package is a PHP script. However, you can create your own script using any language you like.
  
-When you write your own script, just remember that the path to the directory you’re indexing is passed to the script in a CGI environment variable: ​LS_AI_PATH. In PHP, you can retrieve the value with the command $_SERVER[‘LS_AI_PATH’]. ​+When you write your own script, just remember that the path to the directory you’re indexing is passed to the script in a CGI environment variable: ​''​LS_AI_PATH''​. In PHP, you can retrieve the value with the command ​''​$_SERVER[‘LS_AI_PATH’]''​
  
-The script can be placed anywhere you like, but if you want to share it among all of your virtual hosts, just place it under the lsws/​share/​autoindex/​ directory. A General Context” GUI with the URI /​_autoindex/​” and Location ​$SERVER_ROOT/​share/​autoindex/​” is automatically created by LSWS for every virtual host. The default PHP script, located at lsws/share +The script can be placed anywhere you like, but if you want to share it among all of your virtual hosts, just place it under the ''​lsws/​share/​autoindex/​'' ​directory. A **General Context** GUI with the **URI** ''​/​_autoindex/​'' ​and **Location** ''​$SERVER_ROOT/​share/​autoindex/​'' ​is automatically created by LSWS for every virtual host. The default PHP script, located at ''​lsws/​share/​autoindex/​default.php''​, has the same look and feel as Apache’s mod_autoindex.
-/​autoindex/​default.php,​ has the same look and feel as Apache’s mod_autoindex.+
  
-===== Set/​Customize Auto index page globally ​===== +===== Set/​Customize Auto Index Page Globally ​===== 
-  ​* ​To create your own Auto Index Page globally+To create your own Auto Index Page globally, navigate to **Server > General > Index Files** and set **Auto Index** to ''​Yes''​. 
- <​code>​ + 
- Server ​-> General ​-> Index Files -> Auto Index : Set to Yes +If you leave **Auto Index URI** blank, ​the default script (''​lsws/​share/​autoindex/​default.php''​) will be used.  
-</​code>​ + 
-              ​*  ​If you leave Auto Index URI” blank, default script (lsws/​share/​autoindex/​default.php) will be used.  +To use your own script, for example, ''​myindex.php''​, you can place it under the same directory:  ​''​lsws/​share/​autoindex/​myindex.php''​. Do not modify ​''​default.php'' ​directly, as it will be overridden after any upgrades. ​ Your own script and configuration will not be affected by version upgrade. ​Set **Auto Index URI** to ''/​_autoindex/​myindex.php''​ 
-              ​*  ​To use your own script, for e.g. myindex.php,​ you can place it under the same directory: ​ lsws/​share/​autoindex/​myindex.php. Do not modify default.php directly, as it will be overridden after any upgrades. ​ Your own script and configuration will not be affected by version upgrade. + 
-<​code>​ +===== Custom Auto Index Page for Native Virtual Host ===== 
- Server -> General ​-> Index Files -> Auto Index URI: Set to /​_autoindex/​myindex.php” +To customize your Auto Index Page for a particular virtual host if it is natively configured, navigate to **VHost ​> General > Index Files** and set **Auto Index** to ''​Yes''​. ​Set **Auto Index URI** to the URI of your script. 
-</​code>​+ 
 +If Auto Index is enabled, or when a directory with no index file is accessed, LiteSpeed Web Server will perform an internal redirect to **Auto Index URI**. If the value is not set, the URI will contain the default value ''​/​_autoindex/​default.php''​.
  
-===== Customer auto index page for native virtual host ===== 
-        *  To customize your Auto Index Page for a particular virtual host if it is natively configured: 
-<​code>​ 
- VHost -> General -> Index Files -> Auto Index : Set to “Yes”  
- VHost -> General -> Index Files -> Auto Index URI: Set to the URI of your script. 
-</​code>​ 
-      *  If Auto Index is enabled or when a directory with no index file is accessed, LiteSpeed Web server will perform an internal redirect to “Auto Index URI”. If the value is not set, the URI will contain the default value “/​_autoindex/​default.php”. 
 You cannot customize the index file at the virtual host level if the virtual host is configured through an Apache configuration file. In that case, you can only apply a customized index file at the global level. You cannot customize the index file at the virtual host level if the virtual host is configured through an Apache configuration file. In that case, you can only apply a customized index file at the global level.
  
-===== Customize ​auto index page for Apache ​virtual ​Host on control panel envirment ​===== +===== Customize ​Auto Index Page for Apache ​Virtual ​Host in Control Panel Environment ​===== 
-Apache vhost is supported. For Apache vhost, the "Auto Index Uri" ​can be set in .htaccess with LiteSpeed specific directive ​''​AutoIndexUri /<​my_index_script_uri>​''​.+Apache vhost is supported. For Apache vhost, the **Auto Index Uri** can be set in ''​.htaccess'' ​with the LiteSpeed-specific directive
 + 
 +  ​AutoIndexUri /<​my_index_script_uri>​
  • Admin
  • Last modified: 2024/03/28 19:33
  • by Lisa Clarke