Jump to content

Shortest URL string


KingOfHeart

Recommended Posts

I'm creating a little file search on my site. You can search by the name of the file or the type. You can order it by random or by a certain type. You can choose ascending or descending order. Also it will need to know the current page number.

 

So that means my url is going to have a lot of & symbols in it. What method should I use to create a short url string. base64_encode? (How should I separate the string if the answer is yes). Should I just use Sessions (do all browsers support this?)? I'm not sure at this point.

 

 

http://openzelda.thegaminguniverse.com/file.php?type=2&order=1&dir=0&page=2

This is the current page

 

but will be changed to this (assuming I don't break it by the time you view it)

http://openzelda.thegaminguniverse.com/fileb.php

 

 

Link to comment
https://forums.phpfreaks.com/topic/214068-shortest-url-string/
Share on other sites

The vars passed in the query string are needed for site functionality. The only way to avoid them would be to use $_POST instead of $_GET. As far as creating short URL's, you can look into mod_rewrite but the fact that you'll still need access to those variables remains. When using $_POST, you won't be able to copy the url and send it to someone for them to see the search results. Depending upon the type of site you're building, that may be a determining factor in making a decision between GET and POST.

Link to comment
https://forums.phpfreaks.com/topic/214068-shortest-url-string/#findComment-1113943
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.