php-general Digest 14 May 2012 00:13:33 - Issue 7812
Topics (messages 317859 through 317870):
Re: Variables via url
317859 by: Ashley Sheridan
317860 by: TR Shaw
317861 by: Tom Rogers
317862 by: Ashley Sheridan
317864 by: Adam Richardson
317868 by: Ashley M. Kirchner
Re: alias address in REMOTE_ADDR
317863 by: Mike Mackintosh
Time out issue
317865 by: admin
317866 by: Matijn Woudt
317867 by: admin
317869 by: Matijn Woudt
Re: Converting date string to unix timestamp
317870 by: tamouse mailing lists
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
--
---BeginMessage---
On Sat, 2012-05-12 at 09:21 -0400, Jim Giner wrote:
Ashley M. Kirchner ash...@pcraft.com wrote in message
news:4fad9d8b.4020...@pcraft.com...
Can someone point me at examples or directions on how I can pass a
variable via a URL in the following way:
http://server.domain.com//script///variable/
I will only be passing one single /variable/. And I want the
/script/ to use that.
I don't want to see what the script is, for example I don't want it
to say 'script.php' or 'script.html' ...
Is this possible through PHP only, or do I have to write a rewrite
directive in Apache to accomplish this?
A URL has to point to a script - how will your server know what to do with
the incoming URL if it doesn't point to something? That said - format your
URL as a GET string and there's your variable.
Ex.:
http://server.domain.com/(scriptname)?variableanothervariableanothervariable
Or - if this url is coming from an already running script, you could post
the var to a session var and then send a url without the script name and let
your server's default document (index.php ?) receive it and look up the
session var, but that's a pretty silly way to handle things just to hide the
scriptname.
Of course, someone here with much more knowledge than I could very soon make
me look stupid :)
I think what you're looking for is URL rewriting. PHP by itself can't do
that, you need to do it at the server level, so an .htaccess file would
be along the right lines.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
---End Message---
---BeginMessage---
On May 12, 2012, at 9:47 AM, Ashley Sheridan wrote:
On Sat, 2012-05-12 at 09:21 -0400, Jim Giner wrote:
Ashley M. Kirchner ash...@pcraft.com wrote in message
news:4fad9d8b.4020...@pcraft.com...
Can someone point me at examples or directions on how I can pass a
variable via a URL in the following way:
http://server.domain.com//script///variable/
I will only be passing one single /variable/. And I want the
/script/ to use that.
I don't want to see what the script is, for example I don't want it
to say 'script.php' or 'script.html' ...
Is this possible through PHP only, or do I have to write a rewrite
directive in Apache to accomplish this?
A URL has to point to a script - how will your server know what to do with
the incoming URL if it doesn't point to something? That said - format your
URL as a GET string and there's your variable.
Ex.:
http://server.domain.com/(scriptname)?variableanothervariableanothervariable
Or - if this url is coming from an already running script, you could post
the var to a session var and then send a url without the script name and let
your server's default document (index.php ?) receive it and look up the
session var, but that's a pretty silly way to handle things just to hide the
scriptname.
Of course, someone here with much more knowledge than I could very soon make
me look stupid :)
I think what you're looking for is URL rewriting. PHP by itself can't do
that, you need to do it at the server level, so an .htaccess file would
be along the right lines.
Ash is right; however you can leverage off of the index page So your script
would be in index.php and the url would be:
http://server.domain.com/some_optional_directory_path/?variable
Tom
---End Message---
---BeginMessage---
Hello Ashley,
Saturday, May 12, 2012, 9:15:23 AM, you wrote:
Can someone point me at examples or directions on how I can pass a
variable via a URL in the following way:
http://server.domain.com//script///variable/
I will only be passing one single /variable/. And I want the
/script/ to use that.
I don't want to see what the script is, for example I don't want it
to say 'script.php' or 'script.html' ...
Is this possible through PHP only, or do I have to write a rewrite
directive in Apache to accomplish this?
You can add this to