On Tue, 17 Jun 2003 12:41:34 -0600, you wrote:

>I'm a relative newbie to PHP coming from the Zope/Python/DTML world.  Does 
>anyone know of a good way, short of a javascript, to redirect from index.html 
>to index.php.   Also, can I use PHP to test for browsers, then redirect them 
>to the appropriate page.  In DTML/Python it would be :
>
><dtml-if "_.string.find(HTTP_USER_AGENT, 'Mozilla/4') >= 0>
><dtml-call "RESPONSE.redirect('moz4_page.php')">
></dtml-if>
>
>This can be called from anywhere in the page.  I know that PHP does not work 
>this way and that this would need to be done before <html>, but I'm even 
>having problems with that.  I guess I'm just having a hard time THINKING like 
>php.

I can understand that, I kick and scream when forced to think in DTML ('-'
in variable names? Turning the stack inside out? Blah).

Anyway... I suspect, as you're going from index.html -> index.php, you
actually want to add index.php as a Directory Index. Try adding this to your
httpd.conf file:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.php
</IfModule>

and now, /my/path/index.php will be called when you run
http://myhost.com/my/path/

(If I answered the wrong question, I apologise; forcing a redirect from a
pure HTML page will probably need Javascript or meta refresh.)

As to your other question.... yes, it's possible to use PHP to test for
incoming browsers, but it's not exactly good practice. Check
$HTTP_USER_AGENT.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to