• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

19.3. mod_alias

The mod_alias module assists filesystem mapping and URL redirection.

Alias

Alias symbolic_path real_path

[server config, within <VirtualHost>]

Creates a virtual name or directory by mapping a symbolic path that is used in a URL to a real path on the server. Aliasing is useful for organizing server documents, keeping URLs simpler for users, and hiding the structure of a filesystem. For example, the icon directory is aliased in the default configuration file:

Alias /icons /usr/local/etc/httpd/icons

With this setting, a request for /icons/image.gif is handled by sending back the file /usr/local/etc/httpd/icons/image.gif. If you specify a trailing slash on the symbolic path, the client must also enter that slash for the alias to take effect.

(All)

AliasMatch

AliasMatch regex real_path

[server config, within <VirtualHost>]

Similar to Alias but uses regular expressions. This option creates a virtual name or directory by mapping a symbolic pathname that matches the standard regular expression, regex, to a real path on the server. For example:

AliasMatch ^/images(.*) /etc/httpd/server/images$1

(Apache 1.3 or later)

Redirect

Redirect [status] pathname url

[server config, within <VirtualHost> or <Directory>, or .htaccess]

Tells the server to forward clients that request a given directory or document, pathname, to a new location, specified by url. This new location must be a complete path, unless the status given is gone, in which case the new location must be omitted. The Redirect directive supersedes any Alias or AliasMatch directives that are specified.

The status variable can be one of the following:


permanent"

This option uses an HTTP status 301 to indicate to the client that the redirect should be considered permanent.


temp"

This option uses an HTTP status 302 to indicate to the client that the redirect is only temporary. This is the default.


seeother"

This option uses an HTTP status 303 to indicate to the client that the resource requested has been superseded or replaced.


gone"

This option uses an HTTP status 410 to indicate to the client that the resource has been removed.

(Apache 1.2 or later)

RedirectMatch

RedirectMatch [status] regex url

[server config, within <VirtualHost>]

Similar to Redirect but uses standard regular expressions. This option tells the server to forward clients that request a directory or document matching the regular expression regex to a new location, specified by url. For example:

RedirectMatch (.*).jpg http://imageserver.mycorp.com$1.jpg

(Apache 1.3 or later)

RedirectPermanent

RedirectPermanent url-path url srm.conf

Equivalent to Redirect with a status of permanent.

(Apache 1.2 only)

RedirectTemp

RedirectTemp url-path url

Equivalent to Redirect with a status of temp.

(Apache 1.2 only)

ScriptAlias

ScriptAlias symbolic_path real_path

[server config, within <VirtualHost>]

Creates a virtual directory of CGI programs by mapping a symbolic pathname that is used in a URL to a real directory of executable CGI programs on your server. Instead of returning a document in that directory, the server runs a requested file within a CGI environment and returns the output. For example:

ScriptAlias /cgi-bin/ /usr/local/frank/cgi-bin/

See Chapter 12 for more information on CGI.

(All)

ScriptAliasMatch

ScriptAliasMatch regex filename

[server config, within <VirtualHost>]

Similar to ScriptAlias, but uses regular expressions. This option creates a virtual directory of CGI programs by mapping any symbolic pathnames that match the standard regular expression regex to a real directory of executable CGI programs on the server. For example:

ScriptAliasMatch ^/cgi-bin(.*) /usr/local/frank/cgi-bin$1

See Chapter 12 for more information on CGI.

(Apache 1.3 and later)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint