apachehttp-redirectmod-alias

Domain - Fake alias/page


I was thinking about the following but to be honest I'm not even sure if it's possible (or how it is done). Let's suppose that I have www.domain.com, I need to create like "fake pages/alias" for my users. For example, user peter should be able to get to www.domain.com/peter and see his stuff.

As a workaround I've created a PHP scripts and Apache config that are basically reading whatever is added after the .com/ (in this case peter) and redirecting the user to www.domain.com/x/?peter, which is actually index.php?peter but this is not really what I was looking for.

Looking for any idea/suggestions :)


Solution

  • I was able to do it by assuming that every domain.com/XXXX is actually a page that does not exist so I'm manipulating the 404 errors through .htaccess.

    RewriteEngine On
    ErrorDocument 404 /YYY.php
    

    This rule redirects the 404 to YYY.php. In this page I'm using the $_SERVER variable to get the parameter after the .com/ and use it in my scripts.