By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,719 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,719 IT Pros & Developers. It's quick & easy.

$_GET empty with Apache and content negotiation

P: n/a
Hello,

I'm pretty new to PHP but I have a page, B.php, which runs fine, but I
want to be able to call this as B (long story), i.e.
http://mysite/B?foo=bar should be equivalent to calling
http://mysite/B.php?foo=bar.

I've tried creating a symlink on the filesystem B -> B.php but that
just sends the text content of the B.php file itself back to the
caller. (I kind of thought I'd get away with that =) )

My config is Red Hat 9.0 with the included Apache 2.0.40. PHP seems to
built in to the core instead of as a module because it just works and
there's no included module in httpd.conf.

What I've done now is to try the type-map approach from the docs at
http://httpd.apache.org/docs/2.0/con...gotiation.html and added a
file called B.var with contents

URI: B

URI: B.php
Content-type: application/php

Now the call to http://mysite/B?foo=bar works, and the PHP executes,
but the variable $_GET is empty whereas it is not when I execute
http://mysite/B.php?foo=bar.

Undoubtedly it's something to do with mime types or something.

Any thoughts, or suggestions?

Thanks
Ian

Oct 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
da*******@gmail.com wrote:
Hello,

I'm pretty new to PHP but I have a page, B.php, which runs fine, but I
want to be able to call this as B (long story), i.e.
http://mysite/B?foo=bar should be equivalent to calling
http://mysite/B.php?foo=bar.

I've tried creating a symlink on the filesystem B -> B.php but that <snip> What I've done now is to try the type-map approach from the docs at <snip>
Any thoughts, or suggestions?


I'd start again using mod_rewrite.

C.
Oct 20 '05 #2

P: n/a
You're right - I compiled Apache (with mod_rewrite) and PHP from source
and used

RewriteEngine on
RewriteRule ^B?$ /B.php

in .htaccess. Works great. Incidentally there's a bug which convinced
me that using MultiViews was almost pointless -
http://bugs.php.net/bug.php?id=28023.

Ian

Oct 20 '05 #3

P: n/a
dalyian39 wrote:
I'm pretty new to PHP but I have a page, B.php, which runs fine, but I
want to be able to call this as B (long story),
you're right, it is a long story, but it's not yours alone.

I don't see why you would put .php in your URLs anyway.
i.e.
http://mysite/B?foo=bar should be equivalent to calling
http://mysite/B.php?foo=bar.


I would stick with your content negotiation, even if you have only one
representation at the moment, but switch to MultiViews instead.

--
Jock
Oct 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.