473,563 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$_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 2081
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
3323
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 leave the file extension off completely, not only does apache map it to the corresponding php file, but it allows the php module to parse it...
2
3406
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... but I dont understand why! It started when I "compresed" script and addet $_GET in the same "if" set... but it shoudent by eny problem...
7
11866
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 the top of my script I assign a few variables to incoming GET and POST values. $login = clean($_POST, 30); $passwd = clean($_POST, 30);
32
32987
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 the first time the page is loaded). I tryed this code:
9
1747
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 content-negotiation for my Zeus/3.4 Server. My interim goal is to serve XHTML 1.0 documents as Content-Type application/xhtml+xml -- with XML declaration --...
5
8691
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 Date: Wed, 22 Feb 2006 00:01:45 GMT Server: Apache/1.3.33 (Darwin) PHP/5.1.2 mod_perl/1.29 Transfer-Encoding: chunked Content-Type: text/html;...
0
1794
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 variants of Chinese language tags(ie zh-TW) point to English-suffix pages. Our site currently has content negotiation set up for several other...
21
20677
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. I have 7 years experience with various web langauges so we can skip the "METHOD='POST'" comments. I recently setup PHP and Apache (and mySQL) on...
2
3117
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, if not they are redirected to the login page. If logged in they may edit the story. I assign $_GET to $id.
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.