Forum Moderators: phranque

Message Too Old, No Replies

mapping an extension to work in any dir

i thought AliasMatch would do it

         

httpwebwitch

6:04 pm on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



another question for the Apache experts... sort of related to my last question [webmasterworld.com]

I've mapped a new extension in my system:


AddType text/html .pop
AddHandler application/x-httpd-php .pop

I'm using the "pop" extension to handle special common scripts that are available to multiple sites.
These are often included on a PHP page from a central repository defined in php.ini, as suggested here [webmasterworld.com]

Now... from anywhere in any site on my server, I want to be able to link to a ".pop" script. hence, all of these URLs will go to the same script:


example.com/push.pop
example.com/a/push.pop
example.com/a/b/push.pop
example.com/a/b/c/push.pop
example.com/1/2/3/push.pop
anothersite.com/push.pop
anothersite.com/a/push.pop
anothersite.com/a/b/push.pop
anothersite.com/a/b/c/push.pop
anothersite.com/1/2/3/push.pop

described another way, "push.pop" is such a special file that it exists everywhere at once, accessible via a relative path from anywhere.

The file "push.pop" actually resides in a /common_scripts/ directory tucked into public_html

I thought this would work:


AliasMatch (.*)push.pop(.*) /home/myserver/public_html/common_scripts/push.pop$2

but.. it doesn't.
in fact what I get is this:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

any idea what I should try next?

jdMorgan

12:31 am on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are including .pop files as local server files rather than as URLs, then no Apache settings will have any effect on their paths. Remember, Apache is an HTTP server, and does not control the server's filesystem.

I suspect that what you want to do is to set the path variable in the operating system's configuration, so that it knows where to look for these common files.

Jim

httpwebwitch

2:21 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



aaah. well my links will look like this, everywhere:

<a href="push.pop" >click me</a>

The reason I'm investigating this way is that I know it can be done in .NET, with relative ease

On my commute home yesterday I realized I can accomplish the same effect using some basic techniques:

1) change my links to href="/push.pop", that takes care of any depth issues
2) put a "push.pop" file in the root of every site, which consists of one line:
<?php include("common_scripts/push.pop");?>
3) my "common_scripts" directory will be found in a shared script repository since it's registered as an include directory in php.ini

I was only hoping there was a way to do it without step #2