RE: [PHP] How to pass params in URL without ? or &?
| From: | Jason Cox | Date: | Wed, 29 Nov 2000 21:21:51 +0000 |
| Subject: | RE: [PHP] How to pass params in URL without ? or &? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27877@lists.php.net to get a copy of this message | ||
Rasmus gave a solution to this question a couple of weeks ago and I just
happen to still have his email:
<snip>
Search engines have no way of knowing that the content is generated by
PHP. And they don't care. It doesn't matter whether your files end in
.php or .html. Some search engine do indeed not index pages with a ? in
them. You can get around this by using $PATH_INFO arguments instead. So,
for example:
http://www.foo.bar/some/path/script.php/arg1/arg2
$PATH_INFO will contain "/arg1/arg2"
You can also add something like this to your httpd.conf file:
<Location "/some/path/script">
ForceType application/x-httpd-php
</Location>
And then you can make your URL look like this:
http://www.foo.bar/some/path/script/arg1/arg2
This makes things very flexible for you and you can keep your URLs nice
and pretty. I hate big long ugly untypable URLs with a passion. URLs
should be easy to guess. For example:
http://www.foo.bar/products/widget
That should give me information and the product called "widget". You can
make a script named "products" that takes $PATH_INFO and queries the
database and comes back with a page with details about that product.
-Rasmus
</snip>
-----Original Message-----
From: Ken [mailto:kenzo@free-music.com]
Sent: Wednesday, November 29, 2000 1:56 PM
To: php-general@lists.php.net
Subject: [PHP] How to pass params in URL without ? or &?
Surely SOMEBODY has dealt with this issue before. To reiterate, I want to
have a URL like:
http://mysite.com/script.php3/p/value/p2/value2/
and have it call my script "script.php3" and pass it parameters p and p2,
with values value and value2.
I know how to parse "/p/value/p2/value2/" within my script to achieve that
result, but I can't figure out how to configure my Apache or PHP3 to even
call "script.php3" when given a URL like the above.
I'm stuck. The only thing I can think of is that it might not be doable
when running PHP as a CGI instead of running PHP as an Apache module.
Can anyone solve this one?
Thanks greatly. Original message is below.
- Ken
kenzo (at) free-music.com
>Date: Tue, 28 Nov 2000 06:01:05 -0500
>To: php-general@lists.php.net
>From: Ken <kenzo@free-music.com>
>Subject: [PHP] Using http://mysite.com/script.php3/p/value to
>pass value,
PHP CGI
>
>I'm trying to make PHP scripts that have search-engine-friendly URL's (like
http://mysite.com/script.php3/p/value).
I'll be passing parameters around
in the URL's, but I don't want to use & and ?, since this will prevent
search engines from indexing the site.
>
>I'm using PHP 3.0.16 (currently under Win32, so it's a CGI, not an Apache
module) and Apache 1.3.12.
>
>I've encountered various help documents that talk about how to parse the
/p/value part of the URI. I found one document that instructed me to use
ForceType in my Apache conf to get all calls to folder "script" to call a
PHP file called "script" in my docroot, and then have it parse the /p/value.
>
>I have had no luck in getting PHP/Apache to even get as far as opening my
script. I haven't yet tried to deal with parsing issues, as this is still
moot.
>
>In access.conf, I have:
><Location /local>
>ForceType application/x-httpd-php3
></Location>
>
>In my web root, I have a file called "local".
>
>Trying to access the URL http://localhost/local yields:
>
>Fatal error: Unable to open d:\mydocroot\local\ in - on line 0
>
>as returned from my PHP process. So, PHP is being called, but it's not
winding up opening the file I want it to open.
>
>If I rename my file to "local.php3", just as an experiment, and I still use
the same URL as above, the error message changes to:
>
>Fatal error: Unable to open d:\mydocroot\local.php3\ in - on line 0
>
>Can this even be done when running PHP as a CGI?
>
>As a side question, can PHP3 be run as an Apache module? I haven't found
the binaries for this anywhere.
>
>Thanks greatly for any help. I have combed many resources trying to get an
answer to this question.
>
>- Ken
>kenzo(at)free-music.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
_______________________________________________________
Site Design, Hosting, and E-Commerce at www.webpipe.net