php - 404 server redirect, or some other method? -
i know how handle problem guess generic. not sure how supposed done. people can find way around may ill formed thoughts , bad terminology.
i did tinyurl-like service example, nothing should used. it's written in php , uses mysql. it's 1 problem couldn't figure out, , feel i've run before.
the problem when expanding generated url (for simplicity let's assume base url http://a.com , links ordered auto-incremental index give database index when giving tinified url.
for tinyurl link example: http://tinyurl/abcd
i used parameter , end doing http://q.com?u=0
i guess if want have format first 1 set .httaccess in apache server use custom 404 page when going to: http://a.com/0 404, redirected own 404.php , in page handle database lookup , redirect real url.
my problem have gut feeling using 404 "feature" bit dirty. , question if general way it, or if there other ways don't know about.
sorry rant , information!
you should have @ mod_rewrite! in .htaccess file this: rewriteengine on rewriterule ^([a-za-z0-9-]+)/?$ index.php?u=$1
that might not best rule, there plenty tutorials out there!
Comments
Post a Comment