Forum Moderators: phranque
I have www.domain.com/username using a 404 redirect in php that generates the id for the username that is used to pull in the correct page. www.domain.com/user.php?clientid=1234 (the 404 php file does name to id translation).
what i want to do is username.domain.com redirect to /username but I'm not sure if the 404 engine would work after a redirect. (it hasn't from my attemts so far but a trailing / would break the 404).
On top of that our usernames can be complex, such as "my name is blah" or "my.name.is.blah" but the domain.com at the end will always be the same.
I also need both system to remain working for now to maintain google rankings. I've tired the standard subdomain ones replacing the end with domain.com/%1 etc to pass to the 404 engine, howerver that doesn't seem to pass the params.
Anyone who can understand my drible capable of helping please? :)
A better plan would be to use RewriteMap to call your username-to-userID translation script, and rewrite --not redirect-- the request to the userID URL-path. The ability to define RewriteMaps is available only at the server config level and not in .htaccess, but once the map is defined, it can be used from the .htaccess level.
Another way to do this would be to simply rewrite all username requests to your main script, have the script look up the ID, and use it -- without any redirects or error responses at all.
Jim