views:

65

answers:

2

how can I setup httpd.conf so that I can pipe all requests to that port go to a php file?

I am trying to make a socket connection from action script to localhost in flash.

+1  A: 

You can use VirtualHosts...

To have a virtual host work specifically for that port, add the port number to the first line of the virtual host configuration. The first line should look something like the following:

<VirtualHost ip_address_of_your_server:12331>

You must also add

Listen 12331

to the httpd.conf

Now your server is listening to port 12331. In the VirtualHost configuration you can set the DirectoryIndex to route all default requests to a PHP file

<VirtualHost ip_address_of_your_server:12331>
DirectoryIndex myPhp.php
</VirtualHost>

In addition you could also use mod_rewrite and .htaccess files to route specific requests to the same PHP file as well.

I referred to: http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-guide/s1-apache-virtualhosts.html

Srirangan
"In addition you could also use mod_rewrite and .htaccess files to route specific requests to the same PHP file as well." Just a pointer its a common misconception that you need to do this sort of thing within a .htaccess file. Anything that can be done in a .htaccess file can be done in a virtualhost section. if you then turn off overrides eg. AllowOverides None (in virtual host or main section) then the server doesnt need to look for a .htaccess file, which in returns reduces the load.
DeveloperChris
A: 

Set up your virtual host with your single php script as the only file in the web root, then add a 404 error handler to point to that file.

e.g.

ErrorDocument 404 /script.php

C.

symcbean
This is clever, but totally throws the RFC in the roundfile. Pedantic sysadmins and SEO pros everywhere groan.
Lucas Oman