Re: [PHP] User-friendly URI's

2002-01-17 Thread Jonathan David Edwin Wright

Atcually, I#m doing it in Win2k/WinXP. To get the settings in the .htaccess 
file working, you need to make sure you've given permission for that 
directory to override a group of settings.  I belive ForceType belongs to 
the group FileType (someone correct me if I'm wrong! :)

Somewhere in httpd.conf, where you've set your root directory is where you 
need to set it:

Directory /
 #Something
 #Another Think
 AllowOverride FileType
 #OR AllowOverride All
 #Final Thing
/Directory

Check that first, otherwise that line won't force any file to be sent via 
the PHP parser. Also, what errors are you getting, or what is it doing?

At 11:52 17/01/2002 +0800, you wrote:
Hi,
I was implementing this solution a while back.
It works on Linux/Apache/PHP 4.0.6
but during testing on my Win2000/Apache/4.0.6 it doesn't.

I think my php.ini are all aligned.

Any thoughts?

At 09:06 AM 1/4/2002, Jonathan David Edwin Wright wrote:
It's actually alot easier that you think!

for the news file, just create a file called 'news' (minus ' of course! 
;) in your http root, then create (or append) a .htaccess with the 
following lines:

Files news
 ForceType application/x-httpd-php
/Files

That tells Apache to parse news via PHP. As what you've passed (ie 
/2002/01/02/keyword) is not a query string, you won't find it in 
$_SERVER{'QUERY_STRING'}. Instead, its put into $_SERVER{'PATH_INFO'}. 
It's then up to you to do what you want with it! :)

Works for me! :)

Hope that helps! :)

// Jonathan Wright
// [EMAIL PROTECTED]
// GCS d- s: a-- C++(+) US P+++ L+ E W+++ !N w !O M- V- PS+@ PE+
//Y PGP t+ !5 X R- tv(-) b(+) DI D+(++) G h-- r-- z--(++)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User-friendly URI's

2002-01-16 Thread Hasan

Hi,
I was implementing this solution a while back.
It works on Linux/Apache/PHP 4.0.6
but during testing on my Win2000/Apache/4.0.6 it doesn't.

I think my php.ini are all aligned.

Any thoughts?

At 09:06 AM 1/4/2002, Jonathan David Edwin Wright wrote:
It's actually alot easier that you think!

for the news file, just create a file called 'news' (minus ' of course! ;) 
in your http root, then create (or append) a .htaccess with the following 
lines:

Files news
 ForceType application/x-httpd-php
/Files

That tells Apache to parse news via PHP. As what you've passed (ie 
/2002/01/02/keyword) is not a query string, you won't find it in 
$_SERVER{'QUERY_STRING'}. Instead, its put into $_SERVER{'PATH_INFO'}. 
It's then up to you to do what you want with it! :)

Works for me! :)

Hope that helps! :)


At 16:00 03.01.2002 -0800, Mike Eheler wrote:
http://www.somesite.com/news/2002/01/02/keyword

I've seen some sites do this with other scripting languages (maybe even 
PHP.. I just don't know).. I like the look of this *way* better. Anyone 
have any insight as to how I can make that work with an Apache 1.3.xx + 
PHP 4.1.x setup?

news would actually be a PHP script, of course. I know how to handle 
/2002/01/02/keyword as parameters, my question is on making news be 
interpreted through PHP.

Mike


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

// Jonathan Wright
// [EMAIL PROTECTED]
// GCS d- s: a-- C++(+) US P+++ L+ E W+++ !N w !O M- V- PS+@ PE+
//Y PGP t+ !5 X R- tv(-) b(+) DI D+(++) G h-- r-- z--(++)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] User-friendly URI's

2002-01-03 Thread Jason Murray

 news would actually be a PHP script, of course. I know how 
 to handle /2002/01/02/keyword as parameters, my question is on 
 making news be interpreted through PHP.

Off the top of my head...

You could either use a .htaccess to force Apache to recognise
news as a PHP script, or you could use a Custom 404 page to
figure out what the heck the original URL was trying to get at
and silently substitute in the resulting page.

A Custom 404 might be easier, but would have a bit more supporting
infrastructure at the code end for a big site.

Apologies if this is incorrect, I just may not be thinking
too clearly today :)

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User-friendly URI's

2002-01-03 Thread Mike Eheler

A 404 ErrorDoc would still reply with a 404 code, which could mess up 
some search engines.

I was thinking of the .htaccess solution, but I'm not sure if that's 
possible to force only certain files or perhaps all files in just a 
certain directory to all be application/x-httpd-php?

I guess that would be the best solution. :)

Or would it? What if I have an images/ subfolder.. I certainly wouldn't 
want all my images being thrown through PHP. That could cause some 
ugliness. So I guess it would have to be un-doable. Is it?

Mike

Jason Murray wrote:

news would actually be a PHP script, of course. I know how 
to handle /2002/01/02/keyword as parameters, my question is on 
making news be interpreted through PHP.

 
 Off the top of my head...
 
 You could either use a .htaccess to force Apache to recognise
 news as a PHP script, or you could use a Custom 404 page to
 figure out what the heck the original URL was trying to get at
 and silently substitute in the resulting page.
 
 A Custom 404 might be easier, but would have a bit more supporting
 infrastructure at the code end for a big site.
 
 Apologies if this is incorrect, I just may not be thinking
 too clearly today :)
 
 Jason
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] User-friendly URI's

2002-01-03 Thread Jason Murray

 A 404 ErrorDoc would still reply with a 404 code, which could mess up 
 some search engines.

Not true, try this: www.inww.com/ifdbnifoudbvfd

This is actually produced by ErrorDocument 404 /404.php3 in our Apache
configuration, and 404.php3 is a PHP script that sends the neccessary stuff
to be seen as a 404 to a web browser (thats basically a TITLE tag of 404 
Not Found).

You could just as easily subvert 404.php3 to do redirects or include
other stuff to produce the neccessary pages without sending the 404 bits
(and we do, we recently moved all our PDF files into a database and use
404.php3 to silently redirect to the database-drawn version of the file).

 I was thinking of the .htaccess solution, but I'm not sure if that's 
 possible to force only certain files or perhaps all files in just a 
 certain directory to all be application/x-httpd-php?

I believe you can force a single file. I haven't done it, I'm sure
someone else around here can. :)

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] User-friendly URI's

2002-01-03 Thread Jonathan David Edwin Wright

It's actually alot easier that you think!

for the news file, just create a file called 'news' (minus ' of course! ;) 
in your http root, then create (or append) a .htaccess with the following 
lines:

Files news
 ForceType application/x-httpd-php
/Files

That tells Apache to parse news via PHP. As what you've passed (ie 
/2002/01/02/keyword) is not a query string, you won't find it in 
$_SERVER{'QUERY_STRING'}. Instead, its put into $_SERVER{'PATH_INFO'}. It's 
then up to you to do what you want with it! :)

Works for me! :)

Hope that helps! :)


At 16:00 03.01.2002 -0800, Mike Eheler wrote:
http://www.somesite.com/news/2002/01/02/keyword

I've seen some sites do this with other scripting languages (maybe even 
PHP.. I just don't know).. I like the look of this *way* better. Anyone 
have any insight as to how I can make that work with an Apache 1.3.xx + 
PHP 4.1.x setup?

news would actually be a PHP script, of course. I know how to handle 
/2002/01/02/keyword as parameters, my question is on making news be 
interpreted through PHP.

Mike


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


// Jonathan Wright
// [EMAIL PROTECTED]
// GCS d- s: a-- C++(+) US P+++ L+ E W+++ !N w !O M- V- PS+@ PE+
//Y PGP t+ !5 X R- tv(-) b(+) DI D+(++) G h-- r-- z--(++)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] User-friendly URI's

2002-01-03 Thread Opec Kemp

You will need to use the following techniques:

* In Apache you will need to enable mod_rewrite module
http://httpd.apache.org/docs/mod/mod_rewrite.html
this allows you to remap URI to any script, in your case you'd probably
want and request to /news to be mapped to for example /news.php etc.

* In your script you will need to parse the URI via the REQUEST_URI server
variable.

Basically what you're doing in your apache is saying: Pass all requests to
the URI to this instead note that this will not affect the URL display in
your browser.

This is similar technique to making search engines index your site. I've
written replies to this subject a while back check it out here:

(Note that apparently my code in this post has some problem so..)
http://aspn.activestate.com/ASPN/Mail/Message/php-Users/373430

OR a better example here:

Building Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.com/columns/tim19990117.php3

Revisited: Build Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.com/columns/tim2526.php3


HTH

 -Original Message-
 From: Mike Eheler [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 4 January 2002 10:01 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] User-friendly URI's


 http://www.somesite.com/news/2002/01/02/keyword

 I've seen some sites do this with other scripting languages (maybe even
 PHP.. I just don't know).. I like the look of this *way* better. Anyone
 have any insight as to how I can make that work with an Apache 1.3.xx +
 PHP 4.1.x setup?

 news would actually be a PHP script, of course. I know how to handle
 /2002/01/02/keyword as parameters, my question is on making news be
 interpreted through PHP.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]