Custom URL forwarding

Soldato
Joined
6 Mar 2008
Posts
10,079
Location
Stoke area
Hi all,

Looking for advice but on url forwarding but not your normal redirect issues (i don't think).

I want to be able to generate a url in the following fashion:

domain.co.uk/customername.incrementingNumber

then when it hits my site I want to forward that onto another URL. The thing is the customers need to be able to login to an admin panel and change the outgoing URL themselves.

How would you suggest is the best way of approaching this?
 
Associate
Joined
16 Apr 2007
Posts
2,208
Depends what technologies you want to use/are comfortable in, holding a database of urls vs a customername shouldnt be too hard. What sort of server are you running windows or linux?
 
Associate
Joined
16 Apr 2007
Posts
2,208
It'll be with Vidahost on their cloud hosting which is Linux based as far as I am aware.

Was it something you were hoping you could just install or are willing to/want to write?
You could no doubt do this in either ASP.net or PHP both of which Vidahost supports, backed by MSSQL or MySQL database.
 
Soldato
OP
Joined
6 Mar 2008
Posts
10,079
Location
Stoke area
oh no I was looking at writing it from the ground up, just after advice on how others would approach it.

I was thinking PHP + MySQL as I know more about these than anything and it'll make a good project to really learn on :)
 
Associate
Joined
21 May 2013
Posts
1,991
Use htaccess to redirect all requests to the root directory (you will probably have to specify an exception to provide some kind of admin panel).

Run a PHP script at the index that takes the requested url components, validates them, then checks them against the database for the new url to forward to.
 
Associate
Joined
13 Mar 2007
Posts
1,310
Location
Cambridgeshire
If your hosting provider supports it you'd be better off using a RewriteMap - a DBM hash file will be much faster than running a PHP script and going off to an external database for every request, plus you can manage it directly from PHP.
 
Back
Top Bottom