homepage Welcome to WebmasterWorld Guest from 54.161.155.142
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Calling a script from htaccess
mrtonyg




msg:4257892
 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?

 

mrtonyg




msg:4258318
 1:33 pm on Jan 26, 2011 (gmt 0)

Anyone?

jboy




msg:4258319
 1:46 pm on Jan 26, 2011 (gmt 0)

this [webmasterworld.com...] indicates it might be possible

mrtonyg




msg:4258625
 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.

jboy




msg:4259098
 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.

mrtonyg




msg:4259447
 2:29 pm on Jan 28, 2011 (gmt 0)

No luck...thanks anyways.

jdMorgan




msg:4260834
 10:15 pm on Jan 31, 2011 (gmt 0)

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

mrtonyg




msg:4260918
 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

jdMorgan




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

> 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

mrtonyg




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

Jim, thanks.
Your assistance is always appreciated.

Tony

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved