[PHP] Re: How to pass variables to php functions from url's?
On Fri, 7 Sep 2001 13:28:16 +0200 impersonator of [EMAIL PROTECTED] (\ Tais M. Hansen) planted &I saw in php.general: >Hi Martin, > >Take a look at the Apache mod_rewrite docs. > >http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html > > >I added this to my httpd.conf: > Or if you don't have access to httpd.conf and/or not mod_rewrite installed, check to see if you can use .htaccess in your respective directory with adding there handler (your script) for all these files to be processed by. See Apache docs, if/how it is possible to pass params. I didn't use it myself, as my servers don't allow it, but read/lerned s/t. >---snip--- >RewriteEngine on >RewriteCond %{HTTP_HOST}^nu\.osd\.dk$ >RewriteRule ^.*$http://www.osd.dk/main.php?m=nu >[R=301,L] >---snip--- > >If a user types the URL "nu.osd.dk" it will call >http://www.osd.dk/main.php?m=nu. > > >-- >Tais M. Hansen > > > >"Martin Lindhe" <[EMAIL PROTECTED]> wrote in message >831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1... >> I need to solve the following problem, but I can't figure out how: >> Let's assume we have a server called www.test.com >> When a user access http://www.test.com/path/username, >> I want a php script to execute, as if the url entered was >> http://www.test.com/path.php?value=username. >> I'm running PHP 4.0.6 on Apache 1.3.20. >> Thanks! >> /Martin Lindhe > > i Leonid. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
This is what they mean: (from http://www.apache.org/docs-2.0/mod/mod_rewrite.html) *** 'proxy|P' (force proxy) This flag forces the substitution part to be internally forced as a proxy request and immediately (i.e., rewriting rule processing stops here) put through the proxy module. You have to make sure that the substitution string is a valid URI (e.g., typically starting with http://hostname) which can be handled by the Apache proxy module. If not you get an error from the proxy module. Use this flag to achieve a more powerful implementation of the ProxyPass directive, to map some remote stuff into the namespace of the local server. Notice: To use this functionality make sure you have the proxy module compiled into your Apache server program. If you don't know please check whether mod_proxy.c is part of the ``httpd -l'' output. If yes, this functionality is available to mod_rewrite. If not, then you first have to rebuild the ``httpd'' program with mod_proxy enabled. *** 'type|T=MIME-type' (force MIME type) Force the MIME-type of the target file to be MIME-type. For instance, this can be used to simulate the mod_alias directive ScriptAlias which internally forces all files inside the mapped directory to have a MIME type of ``application/x-httpd-cgi''. *** " Tais M. Hansen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > AFAIR it's [P]ermanent and [T]emporary... But I could be wrong!! > -tais -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
I am wrong! ;) " Tais M. Hansen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > AFAIR it's [P]ermanent and [T]emporary... But I could be wrong!! > -tais -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
AFAIR it's [P]ermanent and [T]emporary... But I could be wrong!! -tais "Martin Lindhe" <[EMAIL PROTECTED]> wrote in message 831D8A28AF18D5119EAA00E018C5B81C23BA13@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA13@MAIL1... > >useful link: http://www.apache.org/docs-2.0/misc/rewriteguide.html > >RewriteEngine on > >RewriteRule ^/x/(.*)http://www.server2.com/users/$1 [P] > Hm, what does the [P] do? I played around a bit and figured that > a [T] does the trick for me, thanks! > /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
I think if you use "RedirectMatch temp ..." it'll work... -tais "Martin Lindhe" <[EMAIL PROTECTED]> wrote in message 831D8A28AF18D5119EAA00E018C5B81C23BA11@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA11@MAIL1... > > I think I remember doing it a while ago. But I think you need to use > > mod_alias instead. Take a look here: > > http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect > > The Redirect/RedirectMatch/RedirectTemp might do it. > RedirectMatch permanent "^/x/(.*)" http://www.test.com/y/test.php?val=$1"; > seems to work somewhat equal to the RewriteRule, it also visibly show > the redirect url. Thanks anyway > /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: How to pass variables to php functions from url's?
>useful link: http://www.apache.org/docs-2.0/misc/rewriteguide.html > >RewriteEngine on >RewriteRule ^/x/(.*)http://www.server2.com/users/$1 [P] Hm, what does the [P] do? I played around a bit and figured that a [T] does the trick for me, thanks! /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
[EMAIL PROTECTED] (Martin Lindhe) writes: > > Hi Martin, > > > > Take a look at the Apache mod_rewrite docs. > > > > http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html > > > Thanks alot! > I made a similar solution which works > > RewriteEngine on > RewriteRule "^/x/(.*)""http://www.server2.com/users/$1"; > > takes www.server1.com/x/martin to www.server2.com/users/martin > > Great! I'm also wondering wether i can hide this redirect, as of > now the redirected url is shown to the user useful link: http://www.apache.org/docs-2.0/misc/rewriteguide.html RewriteEngine on RewriteRule ^/x/(.*)http://www.server2.com/users/$1 [P] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: How to pass variables to php functions from url's?
> I think I remember doing it a while ago. But I think you need to use > mod_alias instead. Take a look here: > > http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect > > The Redirect/RedirectMatch/RedirectTemp might do it. > RedirectMatch permanent "^/x/(.*)" http://www.test.com/y/test.php?val=$1"; seems to work somewhat equal to the RewriteRule, it also visibly show the redirect url. Thanks anyway /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: How to pass variables to php functions from url's?
I think I remember doing it a while ago. But I think you need to use mod_alias instead. Take a look here: http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect The Redirect/RedirectMatch/RedirectTemp might do it. -- Tais M. Hansen "Martin Lindhe" <[EMAIL PROTECTED]> wrote in message 831D8A28AF18D5119EAA00E018C5B81C23BA0F@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA0F@MAIL1... > Great! I'm also wondering wether i can hide this redirect, as of > now the redirected url is shown to the user, but i want this > redirect to be unknown, so user is visually on same server. > I figure i can solve this with a little script & a frame or something, > but it's not a good solution, is it possible to do in any other way? > /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: How to pass variables to php functions from url's?
> Hi Martin, > > Take a look at the Apache mod_rewrite docs. > > http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html Thanks alot! I made a similar solution which works RewriteEngine on RewriteRule "^/x/(.*)" "http://www.server2.com/users/$1"; takes www.server1.com/x/martin to www.server2.com/users/martin Great! I'm also wondering wether i can hide this redirect, as of now the redirected url is shown to the user, but i want this redirect to be unknown, so user is visually on same server. I figure i can solve this with a little script & a frame or something, but it's not a good solution, is it possible to do in any other way? /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: How to pass variables to php functions from url's?
Note: The example I wrote is only 3 lines, each starting with RewriteX! Beware of unintended line breaks caused by newsposting. :) -- Tais M. Hansen " Tais M. Hansen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > ---snip--- > RewriteEngine on > RewriteCond %{HTTP_HOST}^nu\.osd\.dk$ > RewriteRule ^.*$http://www.osd.dk/main.php?m=nu > [R=301,L] > ---snip--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: How to pass variables to php functions from url's?
Hi Martin, Take a look at the Apache mod_rewrite docs. http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html I added this to my httpd.conf: ---snip--- RewriteEngine on RewriteCond %{HTTP_HOST}^nu\.osd\.dk$ RewriteRule ^.*$http://www.osd.dk/main.php?m=nu [R=301,L] ---snip--- If a user types the URL "nu.osd.dk" it will call http://www.osd.dk/main.php?m=nu. -- Tais M. Hansen "Martin Lindhe" <[EMAIL PROTECTED]> wrote in message 831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1... > I need to solve the following problem, but I can't figure out how: > Let's assume we have a server called www.test.com > When a user access http://www.test.com/path/username, > I want a php script to execute, as if the url entered was > http://www.test.com/path.php?value=username. > I'm running PHP 4.0.6 on Apache 1.3.20. > Thanks! > /Martin Lindhe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]