Recipe 5.3 Creating a New URL for Existing Content


You have an existing directory which you want to access using a different name.


Use an Alias directive in httpd.conf:

Alias /newurl /www/htdocs/oldurl


While Alias is usually used to map URLs to a directory outside of the DocumentRoot directory tree, this is not necessarily required. There are many times when it is desirable to have the same content accessible via a number of different names. This is typically the case when a directory has its name changed, and you wish to have the old URLs continue to work, or when different people refer to the same content is by different names.

Remember that Alias only affects the mapping of a local URI (the /foo/bar.txt part of; it doesn't affect or change the hostname part of the URL (the part). To alter that portion of the URL, use the Redirect or RewriteRule directives.

See Also

  • Recipe 5.2



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: