I'm having difficulties trying to set the following up:
Currently, User shortens a URL via PHP script, and it outputs http://example.com/3701 where that redirects to the page they inputted, as it is stored in a SQL table.
I've purchased example.com and I'm trying to get Apache to listen on the wildcard *.example.com and for a .htaccess file to pick it up and forward to the URL in the database.
3701.example.com should go directly to the page, not redirect to example.com/3701 then to the page, if possible.
Can this be done, and if so, how?
Thanks! (Apologies with the grammar, I'm Chinese).
EDIT: Nevermind, I got it. Here's the .htaccess for future reference:
Make the DNS listen on *.example.com
RewriteCond %{HTTP_HOST} ^(.*).example.com
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/%1/$1 [L]