473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

$_GET empty with Apache and content negotiation

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
3 2060
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Terence | last post by:
A curious observation: I have my apache web server configured for the PHP apache module to parse files ending in the .php extension. nothing unusual about that, but I also noticed that if I...
2
by: carramba | last post by:
Hi! Tahnx for taking time and reading! This script should load default page and default stylesheet, but its only loads default page, you have to actualy click on the style link to load style......
7
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at...
32
by: Nuno Paquete | last post by:
Hi group. I'm using this code to see if is there any parameter for variable "menu": if($_GET == "downloads") .... But this code log errors if there is no parameter passed (this heappens at...
9
by: James Pickering | last post by:
(update with re-formulated PHP) The W3C Tutorial relating to content negotiation http://www.w3.org/2003/01/xhtml-mimetype/content-negotiation mostly relates to Apache. I am working on...
5
by: Sen Haerens | last post by:
I'm using string.split(/^$/m, 2) on a curl output to separate header and body. There’s an empty line between them. ^$ doesn’t seem to work... Example curl output: HTTP/1.1 404 Not Found...
0
by: alexsink | last post by:
I am trying to get apache content negotiation to redirect only zh-CN(mainland China, where Simplified Chinese translations are available) language types to Chinese web pages, and have all other...
21
tpaine
by: tpaine | last post by:
Let me preface this by saying that this is most certainly not a code issue but a config issue. I have been able to implement the code fine on my live server, this problem only occurs on my localhost....
2
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.