hmvartak Posted June 23, 2009 Share Posted June 23, 2009 How can I use $_server['path_info'] for shorter links. My website generates links that look like this : http://chaingame.110mb.com/slots.php?cnt=971 . I want to make it like http://chaingame.110mb.com/971 . How can I do this? I have already googled for this but not getting what I want. Please help! Link to comment Share on other sites More sharing options...
trickstar34 Posted June 23, 2009 Share Posted June 23, 2009 hmm, not sure which approach to take, I use ASP.Net, but I know basic PHP, but I think you want to make a text or XML file and then a XSL for them if your trying to do that. Link to comment Share on other sites More sharing options...
Edmachine Posted June 23, 2009 Share Posted June 23, 2009 ... You'd need this. However, if I remember correctly, 110mb didn't allow custom .htaccess for free. You have to upgrade. Which sucks. The host itself has gotten worse, a lot worse. You had to give them money to have a database. Although, things may have changed. Anyway, if you really want that type of links, you need a new host. I, personally, like the index.php?id=2 type links, but that's just me. We will be the arms that lift you up We will be the hand that strike you down Link to comment Share on other sites More sharing options...
fred Posted June 23, 2009 Share Posted June 23, 2009 You can use PATH_INFO with links like /slots.php/971. The $_SERVER['PATH_INFO'] variable should then contain "/917" so you just need a bit of string manipulation to get the ID out. E.g. $id = (int) substr($_SERVER['PATH_INFO'], 1); If you want to get rid of slots.php from the URL altogether, then as said above, you'll need to use URL rewriting. Link to comment Share on other sites More sharing options...
K^2 Posted June 23, 2009 Share Posted June 23, 2009 My solution would have been to write a custom server and use DLLs instead of PHP files. But I'm not entirely sane when it comes to these things. Prior to filing a bug against any of my code, please consider this response to common concerns. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now