Apache userdir with custom url

Posted on

Apache userdir with custom url – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, mod-userdir, , , .

mod_userdir seems to be able customize where the home folders are, but is there a way to make those available under a custom URL?

I want to provide users with a url like the following:

Solution :

This is entirely doable. I did just that and recorded the efforts here. This is a solution that does use mod-rewrite, but not deep wizardry. The problem we had was that when we were implementing user_dirs, The Powers That Be thought using a shift key to get at a directory was too much work and wanted a tilde-free version. That’s a one character version of what you’re doing.

The meat is in the RewriteRule statements.

RewriteRule  ^/somestring/([a-z0-9]+)         /~$1    [R]

The problem here is that /~username will still work. You can possibly get around that by using an internal proxy-redirect to another hidden domain name.

RewriteRule ^/somestring/(a-z0-9]+)        http://othervhost.example.com/~$1      [PT]

Leave a Reply

Your email address will not be published. Required fields are marked *