Forum Moderators: phranque

Message Too Old, No Replies

apache and php function

Finfing a php function to make out of a variable-rich url a canonical ones

         

rodia

11:36 am on Sep 14, 2008 (gmt 0)

10+ Year Member



Hi everybody,

I am having some problems trying to solve the interface between my apache RegEx and how to create a php function.
I have an url like this

http://www.example.com/details.php?Id=d&Fields=arrivaldate=19/12/2007¦CompanyID=Rb¦Site=rent4barcelona¦numbernights=3¦datafilename=barcelona-ravalravalsalvadors2bedroomapartment¦adults=4¦children=0¦infants=0¦babies=0¦offercode=¦basis=AO
¦Currency=EUR¦language=eng¦arrivalday=19¦arrivalmonth=12¦arrivalyear=2007¦Affiliate=¦UnitID=
¦Country=Spain¦PlaceNo=1¦DevNo=5¦AccNo=5¦InfoUnitNo=Bra01¦Extras=Extraendclean,
¦Place=Barcelona%20-%20Raval¦Property=Raval%20Salvadors¦Accommodation=2%20Bedroom%20Apartment
¦Price=1.00¦GPF=-1¦MaxGuests=4¦Bathrooms=2¦NoRooms=¦Category=¦DevCountry=Spain
¦DevFeatures=Balconyter~Bath~Coffeetea~Cooker~Cookinguten~Dvdplay~Adsl~Lift~Microwave~Queenbed
~Toaster~Tvremote~Washmach~Rfurnish¦Floor=3¦Bedrooms=2¦DoubleBeds=1¦SingleBeds=1¦SofaBeds=¦

It passes a lot of values that are displayed in the url. I have already a RegEx for my .htaccess

RewriteRule (http://.+/).+\¦Property=([^¦%]+)(%[0-9][0-9]([^¦%]+))?(%[0-9][0-9]([^¦%]+))?\¦.+ <http://.+/%29
.+%5C%7CProperty=%28%5B%5E%7C%%5D+%29%28%%5B0-9%5D%5B0-9%5D%28%5B%5E%7C%%5D+
%29%29?%28%%5B0-9%5D%5B0-9%5D%28%5B%5E%7C%%5D+%29%29?%5C%7C.+>

But I am wondering what sort of php function I could build so that all the values passed in the url remain invisible.
Anybody a clue, please?
Cheers

[edited by: jdMorgan at 5:47 pm (utc) on Sep. 14, 2008]
[edit reason] Broke lines to avoid side-scrolling [/edit]

vincevincevince

11:47 am on Sep 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



base64_encode() will make them much less visible; you then need to base64_decode on the other side and split into variables. A lot of work.

Usually when you need to send lots and lots of variables and the URL string annoys you, use POST not GET. Technically you are right; GET is for getting, POST is for putting... but POST does have the advantage of hiding the string.

g1smd

11:54 am on Sep 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Never let search engines see those URLs otherwise they will be bumbling round your site and submitting data into your system!

rodia

12:27 pm on Sep 14, 2008 (gmt 0)

10+ Year Member



thanks guys for your replies ;)

I just wondered if there was a simple way to reduce the url and pass the values without showing them. Any php function that will not allow search engines to enter data in the url...
I can do that as a regex for apache, but is there a way with php to rewrite the url keepin those values?

jdMorgan

5:48 pm on Sep 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could store those variables in a session cookie -- Either manually or with PHP Sessions.

Jim