Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PHP] Parsing files without extensions.

0 views
Skip to first unread message

Jeff MacDonald

unread,
Nov 20, 2000, 2:40:51 PM11/20/00
to
Hi

In an effort to make pages more search engine friendly,
i'd like to be able to have php parse a few that do not
have extensions..

ie, if it could parse the file "zoom" then i could make
urls like http://foo.com/zoom/1231

instead of http://foo.com/zoom.php?id=1234

i've conquered the /1232 vs. id=12312 problem already..
just parse the get string.. but now to make php parse
zoom

i've added

AddType application/x-httpd-php zoom

into httpd.conf with no effect (yes i restarted apache)

any idea's ?


Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
je...@pgsql.com | je...@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Facsimile : 1 902 542 5386
IRC Nick : bignose


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general...@lists.php.net
For additional commands, e-mail: php-gene...@lists.php.net
To contact the list administrators, e-mail: php-lis...@lists.php.net

Joe Stump

unread,
Nov 20, 2000, 2:50:17 PM11/20/00
to
Try AddType application/x-httpd-php /path/to/zoom

Where /path/to is your root - so like this:

http://www.server.com/scripts/zoom would be
AddType application/x-httpd-php /scripts/zoom

Attached is a copy of my httpd.conf file that does this.

--Joe

------------- my .htaccess file in my / ------------------
AddType application/x-httpd-php3 php .php3 .phtml .html .inc
AddType application/x-httpd-php3 /redirect.php
AddType application/x-httpd-php3 /index.php
AddType application/x-httpd-php3 /articles.php
AddType application/x-httpd-php3 /boards/replies.php
AddType application/x-httpd-php3 /boards/threads.php
------------- my .htaccess file in my / ------------------


>
> into httpd.conf with no effect (yes i restarted apache)
>
> any idea's ?
>
>
> Jeff MacDonald,
>
> -----------------------------------------------------
> PostgreSQL Inc | Hub.Org Networking Services
> je...@pgsql.com | je...@hub.org
> www.pgsql.com | www.hub.org
> 1-902-542-0713 | 1-902-542-3657
> -----------------------------------------------------
> Facsimile : 1 902 542 5386
> IRC Nick : bignose
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general...@lists.php.net
> For additional commands, e-mail: php-gene...@lists.php.net
> To contact the list administrators, e-mail: php-lis...@lists.php.net

================================================================================
= Joe Stump joest...@yahoo.com http://www.miester.org =
================================================================================
"Real programmers don't comment their code.
It was hard to write, it should be hard to understand."

Paul A. Owen

unread,
Nov 20, 2000, 2:50:07 PM11/20/00
to
If you are using Apache then take a look at its rewrite module. It does
this kind of stuff rather well.

See: http://www.apache.org/docs-1.2/mod/mod_rewrite.html

Paul A. Owen
www.ywebwerks.com

Paul A. Owen

unread,
Nov 20, 2000, 3:08:40 PM11/20/00
to
Do you want to map "zoom" to "zoom.php"? If so then just set up a
rewrite rule. In your php code the generated links will be
"http://foo.com/zoom/1231" but get mapped to
"http://foo.com/zoom.php?id=1234" by mod_rewrite and then passed to the
php interpretor. When you write your php files leave the ".php", you
don't have to remove it.

Paul.

Jeff MacDonald

unread,
Nov 20, 2000, 2:57:24 PM11/20/00
to
please read my entire email.. i can do that part fine now.. it's parsing
the php file that i need..

thanks tho..

On Mon, 20 Nov 2000, Paul A. Owen wrote:

> If you are using Apache then take a look at its rewrite module. It does
> this kind of stuff rather well.
>
> See: http://www.apache.org/docs-1.2/mod/mod_rewrite.html
>
> Paul A. Owen
> www.ywebwerks.com
>
>

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
je...@pgsql.com | je...@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Facsimile : 1 902 542 5386
IRC Nick : bignose

Mark Maggelet

unread,
Nov 20, 2000, 2:58:36 PM11/20/00
to
On Mon, 20 Nov 2000 15:42:05 -0400 (AST), Jeff MacDonald
(je...@hub.org) wrote:
>Hi
>
>In an effort to make pages more search engine friendly,
>i'd like to be able to have php parse a few that do not
>have extensions..

A couple of good ways are to use ForceType or DefaultType, I like
DefaultType because it won't mess with other files in the same
directory:

DefaultType application/x-httpd-php

will make php parse any file w/ an extension it doesn't recognize and
also files w/ no extension.

- Mark

Jeff MacDonald

unread,
Nov 20, 2000, 3:04:06 PM11/20/00
to
hey great !

works but i still need a little advise..

i tested it on my home machine.. with 1 domain on it

the actual machien that i want to do this on is a production
machine with over 100 domains.. each has it's own config
section in httpd.conf (or included files thereof)

i added this line to the appropriate secion, SIGHUP'd but
no go..

how can i make it so .htaccess changes will take effect ?
Allowoverride all ?

jeff

Teodor Cimpoesu

unread,
Nov 21, 2000, 4:58:14 AM11/21/00
to
Hi Jeff!

On Mon, 20 Nov 2000, Jeff MacDonald wrote:

> Hi
>
> In an effort to make pages more search engine friendly,
> i'd like to be able to have php parse a few that do not
> have extensions..
>
> ie, if it could parse the file "zoom" then i could make
> urls like http://foo.com/zoom/1231
>
> instead of http://foo.com/zoom.php?id=1234
>
> i've conquered the /1232 vs. id=12312 problem already..
> just parse the get string.. but now to make php parse
> zoom
>
> i've added
>
> AddType application/x-httpd-php zoom
>
> into httpd.conf with no effect (yes i restarted apache)
>

<Directory /path/to/dir>
<Files "zoom">
ForceType application/x-httpd-php
</Files>
</Directory>

and in zoom.php:

$path_info = explode ('/',getenv('PATH_INFO'));


-- teodor

Jeff MacDonald

unread,
Nov 21, 2000, 8:16:07 AM11/21/00
to
you read my mind.
i'll test this.. thanks.

jeff

On Tue, 21 Nov 2000, Teodor Cimpoesu wrote:

> Hi Jeff!
> On Mon, 20 Nov 2000, Jeff MacDonald wrote:
>
> > Hi
> >
> > In an effort to make pages more search engine friendly,
> > i'd like to be able to have php parse a few that do not
> > have extensions..
> >
> > ie, if it could parse the file "zoom" then i could make
> > urls like http://foo.com/zoom/1231
> >
> > instead of http://foo.com/zoom.php?id=1234
> >
> > i've conquered the /1232 vs. id=12312 problem already..
> > just parse the get string.. but now to make php parse
> > zoom
> >
> > i've added
> >
> > AddType application/x-httpd-php zoom
> >
> > into httpd.conf with no effect (yes i restarted apache)
> >
>
> <Directory /path/to/dir>
> <Files "zoom">
> ForceType application/x-httpd-php
> </Files>
> </Directory>
>
> and in zoom.php:
>
> $path_info = explode ('/',getenv('PATH_INFO'));
>
>
> -- teodor
>
>

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
je...@pgsql.com | je...@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Facsimile : 1 902 542 5386
IRC Nick : bignose

jeremy brand

unread,
Nov 21, 2000, 8:46:56 PM11/21/00
to
You can also check out my variables_from_uri() function:
http://www.nirvani.net/software/variables_from_uri.php.asc

Enjoy.

-jeremy brand

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: jer...@nirvani.net
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
- - - - - - - - - - - - - - - - - - - - - - - - -
I am pleased to see that we have differences. May we together become
greater than the sum of both of us.
-- Surak of Vulcan, "The Savage Curtain", stardate 5906.4

On Tue, 21 Nov 2000, Benjamin Munoz wrote:

> Date: Tue, 21 Nov 2000 17:58:33 -0800
> From: Benjamin Munoz <bmu...@ivtweb.com>
> To: 'Jeff MacDonald' <je...@pgsql.com>, Teodor Cimpoesu <t...@digiro.net>
> Cc: php-g...@lists.php.net
> Subject: RE: [PHP] Parsing files without extensions.
>
>
> There's an article with more info on this at:
>
> http://www.faqts.com/knowledge-base/view.phtml/aid/124/fid/342
>
> -Ben

Benjamin Munoz

unread,
Nov 21, 2000, 8:44:09 PM11/21/00
to
0 new messages