Forum Moderators: phranque
I'm realy not that good at regexp or Rewrite Engine.
I have the following structure:
/home/ftphome/users/user1/html
/home/ftphome/users/user2/html
/home/ftphome/users/user3/html
The users are not system users (security reasons) but are fetched from a MYSQL database.
I'm using:
<VirtualHost 1.2.3>
ServerAdmin webmaster@myserver.com
DocumentRoot /home/ftphome/users/
ServerName webspace.myserver.com
#Custom Redirect to noindex if folder has no index file
<Directory /home/ftphome/users/*>
Options All +Includes
AllowOverride None
Options -Indexes
ErrorDocument 403 /errors/noindex.php
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/webspace_error_log
CustomLog logs/webspace_access_log combined
#Custom Error Messages
ErrorDocument 400 /errors/badrequest.php
ErrorDocument 401 /errors/authorize.php
ErrorDocument 403 /errors/forbidden.php
ErrorDocument 404 /errors/notfound.php
ErrorDocument 500 /errors/servererror.php
</VirtualHost>
http://webspace.myserver.com/user1/html Is there any method to make the document root point to:
/home/ftphome/users/*/html/ Or use an alias, rewrite, redirect to make the path be:
http://webspace.myserver.com/user1/ /home/ftphome/users/user1/html/ For ALL users?
Cheers,
Zeno.
This problem would be easy if the users always requested /user/html, because then detecting that a rewrite or alias is needed would be easy -- just look for that "html" in the requested URL path. But that would look "ugly" and usability would suffer. So how do you decide whether to invoke a rewrite or alias using your current URL structure? I don't see a good way to do it.
Consider using one of three possible methods to make this determination easier:
The key is to provide the server with an easy way of detecting URLs that it needs to change versus those that it should leave alone.
Also, there is no need to redirect and you should avoid it, as this exposes the "real" user directory paths to users, inviting security problems. Instead, use internal rewrites or aliases. These change the server filepath associated with a requested URL, but do not change the URL or notify the client (browser) that the URL has changed. The action is therefore transparent to users and search engine spiders alike.
I suggest you research this for several days before committing yourself to any specific approach; You'll have to live with the decision for a long time, and any later changes would likely upset your users and risk losing much of your current search engine rankings/listings.
Jim