473,662 Members | 2,375 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 2085
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
3335
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 accordingly.
2
3408
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
11869
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
33014
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
1749
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 -- to Firefox browsers and as text/html-- without XML declaration (in order to render in "standards"...
5
8695
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; charset=iso-8859-1
0
1799
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 languages, and we have the corresponding html files for those languages being properly served. After...
21
20691
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 my windows XP box. This is my first experience with PHP and it took me a long time to get everything...
2
3125
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
8432
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8633
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
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
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.