Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'mod_rewrite could also be used' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
mod_rewrite could also be used
Authored by: awk on Oct 28, '02 12:54:32PM

It's also possible to do this automatically with some mod_rewrite mumbo-jumo, just add this to the end of your /etc/httpd/httpd.conf:

RewriteEngine on RewriteCond %{REQUEST_URI} ^/+([a-z][a-z0-9]+)(/+(.*)|$) RewriteCond /Users/%1/Sites -d RewriteRule .* /Users/%1/Sites/%3

It checks for any request matching /xyz, /xyz/, /xyz/other/stuff, where xyz is any letters and numbers. Then it checks that the directory /Users/xyz/Sites exists. If so it rewrites the request to match that directory.

I don't know the impact this would have on performance, but it works okay for me! (Actually on my machine I have it do a redirect to /~xyz/ but the idea is similar.)



[ Reply to This | # ]