/    Sign up×
Community /Pin to ProfileBookmark

shorten long url?

[U]Without mod rewrite![/U]

example:

from:
http:// site dot com/address.php?address&blqblqblq

to:
http:// site dot com/

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 15.2011 — If you don't want the query data in the URL (the "address") then you'll need some other way of telling the server what to do. You could put the address "blqblqblq" in a cookie named "address", or make the link actually be a form element that sends it via post, or some other clever trick I haven't thought of. And I suppose you'd have to set up address.php to be the default file name (at least for that directory) via .htaccess or whatever, or else make index.php include address.php if the address parameter is received (e.g. via post data)?
Copy linkTweet thisAlerts:
@SyCoNov 16.2011 — http://site.com/ is actually going to http://site.com/index.php (or .html etc) the index is not shown by the server but it is programmed to pull the index page when no page is given. It does the same thing with the subdomain www which is why is can be omitted most of the time these days.

If you just want address.php to appear as the default content for your index then you could include it or simply rename address.php to index.php and add a 301 redirect to address.php.

Most likely the the data in the query string (after the ?) is needed by the script or it wouldn't be getting passed in the first place. So you could store all data against a session id or in a database and update it constantly as users move around, tracking links clicked and including content based on ids that are stored to a single index page..... but that sounds like a nightmare for you as a coder and a user too. Nothing would be bookmarkable (is that a word yet?)

If you just want a clean URL as users move around the site you could create an index page with a frame that all other pages navigate inside. *shudder* Please don't.

I suppose if you say why you are trying to do what you are asking, you may get more useful answers.
×

Success!

Help @jouvenet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...