Url enconding [PHP]

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

w1ww

Established Member
Impact
9
How can I encode the url after the /?

I saw some sites that have strings like www.site.com/ab23434534ffg44t instead of the php file..

How to do it? Any example?

Thank you!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Unsure what you mean by encoded (well, im not...but i have never seen it like you describe)

But to achieve the /this/that/thisagain urls you use an apache module called "mod_rewrite".

There are some good tutorials on it that can be found by using google or http://pixel2life.com

For example: http://www.workingwith.me.uk/articles/scripting/mod_rewrite

Example of usage:
Code:
RewriteEngine On
RewriteRule ^category/([^/.]+)/?$ /index.php?category=$1 [L]

/category/photoshop

index.php?category=photoshop
 
Last edited:
0
Close
0
Close
What you're probably seeing is base64 encoding. Unless you want to encode your GET values so that they can't be filtered by the user's ISP (like some proxies do), it's pointless and unnecessary. It provides absolutely no security as it is easily decoded and meant for conveying binary data as text.

http://us3.php.net/base64_encode
http://us3.php.net/base64_decode
 
0
Close
if your asking why there isnt a file name there, someone showed me a php script he used to achieve that effect...
it emulated the file name somehow.
ill try and find the code
 
0
Close
You can do that by generating random numbers and letters, assigning them to an array along with the url you want, and then saving that as a session.

You'd have to make an htaccess to make it read though.

If I can remember how I did it... it was like this (in pseudo-code):

Code:
// this would be the index file/redirector

function makeCode()
//function to generate random code

make a session with the code generated by makeCode()
make an array
assign url as a variable in the array
assign whatever else in here


// this is how to call it

read the sessions on the page
clear the sessions on the page

load the url included in the session array

It's not exactly like that but that's the general idea.
 
0
Close
If you are asking why there is no filename, it is all mod_rewrite.

Assuming that there is only one PHP file you need to send data to:

Code:
RewriteEngine On
RewriteRule (.*) /SCRIPTTHATPARSESTHEINFORMATION.php?GET_VARIABLE=$1 [L]
 
0
Close
JRBHosting said:
If you are asking why there is no filename, it is all mod_rewrite.

Assuming that there is only one PHP file you need to send data to:

Code:
RewriteEngine On
RewriteRule (.*) /SCRIPTTHATPARSESTHEINFORMATION.php?GET_VARIABLE=$1 [L]

It's like there's an echo :o
 
0
Close
Woah...didn't see your post there. I guess I'm not that special...*sob* :(

:)
 
0
Close
If you really wanna do that then use mod_rewrite as shown above, however its pretty pointless tbh, why do you want to encode the bit after the / anyway?
 
0
Close
There are some cases where transferring login info via POST is impossible...maybe that is the case.
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Each character of a domain name in its own box, with how to type one of them
Bookmarks: see bookmarks without a label
You can now show only the bookmarks you have not labeled. Open the label filter in the Bookmarks tab of your account menu, or on your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back