Just to be clear, I'm basing this on the assumption that you really do want http://local.example.com to load the literal web page http://localhost/path/to/example.com. In other words, this will only work for this machine. If, on the other hand, you're trying to serve web pages to the outside world using your Mac OS X machine, then that's a different question.
First, add a new line to your /etc/hosts
file:
127.0.0.1 local.example.com
You can do this by running the command sudo nano /etc/hosts
, add this line to the end, then save it by pressing Ctrl-X, Y.
How you actually redirect/alias the address http://local.example.com to http://localhost/path/to/example.com/ depends on which web server you're using. Assuming you're using Apache:
If you want the user's browser to show local.example.com, then you want to set up a virual host and your httpd.conf
file should have something like the following:
<VirtualHost *:80>
ServerName local.example.com
DocumentRoot /www/path/to/example.com
</VirtualHost>
If, on the other hand, you want the web browser's location bar to change to http://localhost/path/to/example.com/, then instead you will want to use mod_rewrite to create a redirect:
RewriteCond %{HTTP_HOST} !^local\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://localhost/path/to/example.com/$1 [L,R,NE]
?
is allowed.
Only 0x00
(NUL
) and :
are forbidden for HFS+.
:
however is switched in POSIX-based software to /
:
Thanks to Graham Lee who corrected me on this!
Best Answer
First of all, I wonder if the 1 MB is correct: true, Finder's Show Info tells you this, but in Terminal the file sizes are always just half of that. Odd.
The size is due to embedded icons. Note that an alias to an application (more precisely: an application bundle) might be much smaller than an alias to a plain folder. Hence, I guess plain folders use a higher definition icon than, for example, iTunes does. And indeed, if you change the icon of the source, the icon of the alias is not changed.
In Terminal you'll see:
So: 4 bytes more in the "Resource Fork" for each letter in the file name, and on the file system things are padded a bit. That same Resource Fork also includes the icons. If you have the Apple Developer Tools installed:
That text file then shows you more than 32,000 lines of text that represents the icon.
(See also Ars Technica about HFS+. Without the Developer Tools, your can use
xattr -l
to kind of see what's in those extended attributes.)