Kenni,
I asked a similar question several months ago and got a lot of terrific
info from the list. First some links:
See this related link:
Q "How can I pass variables to a script in the url
like /script/var1/var2?"
http://www.faqts.com/knowledge_base/view.phtml/aid/124
Includes tutorials for doing it in PHP, mod_rewrite
and/or mod_mime.
and
Search Engine Friendly URLs with PHP and Apache
http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Ap
ache/17/15049/index.html
Search Engine Friendly URLs (Part II)
http://www.evolt.org/article/Search_Engine_Friendly_URLs_Part_II/17/1717
1/index.html
and finally:
http://httpd.apache.org/docs/mod/mod_rewrite.html
The approach I used was the Apache web server's mod_rewrite (rewrite
engine) and then apply the appropriate rules to an htaccess file. If
you have the rewrite engine installed (and loaded in your httpd.conf
file), then try the following in your .htaccess file:
RewriteEngine On
RewriteRule ^foo\.php(./*) $ http://your domainname.com/foo.php?id=$1 [R]
The '.' is a concactenator in the rules so it must be escaped unless
used as such. If you wanted to add an ending forward slash for
foo.php/12/ then perhaps use (./*/)
HTH,
Nicole
PS - many thanks once again to all who helped answer this question for me!
Kenni Graversen wrote:
>Hi,
>
>I wonder if any of you have experience, sending variables in the url without
>using the ? character.
>
>When sending variables this is the normal way to do it:
>/foo.php?id=12
>
>But I have read that the following URL should work:
>/foo.php/12/
>
>and then fetch the id in this way:
>$id = ereg_replace('[^0-9]', '', $PATH_INFO);
>
>I have even seen it in function but the problem is that I can't get it to
>work on my local apache server.
>When I try to write /foo.php/12/ I get a '500 Internal Server Error' and in
>the apache error-log I can read that 'Premature end of script headers:
>c:/php/php.exe'. Does anyone know what could cause this error and why the
>url isn't working??
>
>thanks
>
>Kenni Graversen
>
>
>
>
>
--
########################
Nicole Lallande
[EMAIL PROTECTED]
760.753.6766
########################
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php