Welcome to WebmasterWorld Guest from 54.162.167.40

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Calling a script from htaccess

     
4:27 pm on Jan 25, 2011 (gmt 0)



Hello all,

Is it within the scope of the htaccess file to call up a mail.php file to send an automated email based on the useragent?

I would not want browser redirection.

Thanks in advance,

Tony

PS. I just realized the title does not make sense...how do I edit the title in the post?
1:33 pm on Jan 26, 2011 (gmt 0)



Anyone?
1:46 pm on Jan 26, 2011 (gmt 0)



this [webmasterworld.com...] indicates it might be possible
8:54 pm on Jan 26, 2011 (gmt 0)



jboy, thanks for link!

I tried adding the "php_value auto_prepend_file" directive to my htaccess to no avail.

I then tried adding it to the php.ini file but my hosting company states that the PHP configuration with LiteSpeed servers and PHP is different than with Apache...so no go.

Unless there is another way around this I am out of luck.
7:00 pm on Jan 27, 2011 (gmt 0)



according to this [php.net...] it should work. i'm clueless about this kind of thing so i can't offer any further help myself.
2:29 pm on Jan 28, 2011 (gmt 0)



No luck...thanks anyways.
10:15 pm on Jan 31, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Since you used the term "call," I assume that you want control to return to .htaccess after the script runs.

You can use a rewritemap in .htaccess to do this, but the RewriteMap must be defined at the server config level.

Otherwise, consider calling the script, and then (because the script won't "return" to .htaccess), implement all remaining functions in the script itself -- possibly duplicating the functions in your .htaccess file. For example, an internal rewrite in .htaccess can be replaced with an include (require directive) in a script.

Jim
1:38 am on Feb 1, 2011 (gmt 0)



Thanks Jim.

What I am looking for is some htaccess code that will trigger say a sendmail.php file to send an email based on either a useragent or referring url.

I would like for the htaccess file to continue through its lines after triggering the php file. I would just want the php file to handle the email.

The instructions you posted would achieve this?

I think I might be in over my head on this one.

Tony
6:58 pm on Feb 7, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> I would like for the htaccess file to continue through its lines after triggering the php file.

This requires that you define a RewriteMap in the server configuration file, which you can then call from .htaccess. See mod_rewrite RewriteMap, specifically the documentation showing a script as the map-type, for more info.

Jim
7:16 pm on Feb 7, 2011 (gmt 0)



Jim, thanks.
Your assistance is always appreciated.

Tony
 

Featured Threads

Hot Threads This Week

Hot Threads This Month