Forum Moderators: phranque

Message Too Old, No Replies

.htaccess - run php program

         

RonaldoL

6:18 pm on Oct 4, 2011 (gmt 0)

10+ Year Member



Hi,

I'm doing something wrong with .htaccess and I don't know how to fix.

When my html page are loaded on the client browser I need to execute a php on the server side.

I'm using an image to know that the page are loading and redirecting the image, into .htaccess, to the php program.

But, the image are never displayed on the client browser, when the server receives the request to the image, it redirects imediatelly to the scripts, without send the image to the client browser.

How could I start the php and finished the load of the initial page?

My .htacces

Options +FollowSymlinks
IndexIgnore *
RewriteEngine on
RewriteRule ^test.gif$ program01.php


Thanks in advance for any help,

Ronaldo

g1smd

12:47 am on Oct 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For starters, escape the literal period in the pattern and add the [L] flag to the rule.

Beyond that, I see nothing in your example code to cause the problem you are describing.

RonaldoL

3:11 am on Oct 5, 2011 (gmt 0)

10+ Year Member



Hi,

On the link below you could see the behavior that I described, the image that are defined into the .htaccess aren't displayed. The others are displayed correctly.

[imoveisplus.com.br...]

Thanks for help

[edited by: RonaldoL at 3:15 am (utc) on Oct 5, 2011]

RonaldoL

3:14 am on Oct 5, 2011 (gmt 0)

RonaldoL

5:19 am on Oct 5, 2011 (gmt 0)

10+ Year Member



HI,

I changed the .htaccess to these new commands and still didn't work.

Options +FollowSymlinks
IndexIgnore *
Header add MyHeader "Executing htaccess...."
RewriteEngine on
RewriteCond %{THE_REQUEST} ^Carrega01.html$
RewriteRule ^$ send_email.php [L]

I'm tryng to do check if the request are loading "Carrega01.html", if the request are doing the load, I'll redirect to send_email.php.

What's wrong?

g1smd

7:23 am on Oct 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule ^$
matches a request for example.com/ only.

%{THE_REQUEST} ^Carrega01\.html$
matches a request for example.com/Carrega01.html only.

When used in the same ruleset, the rule will NEVER run.

Minor point on correct syntax: you need to escape the literal period in the pattern.

RonaldoL

12:56 pm on Oct 5, 2011 (gmt 0)

10+ Year Member



Hi,

I made the changes and now I'm starting the php program.

But, the image that start the php program aren't displayed on the page.

My htaccess now

Options +FollowSymlinks
IndexIgnore *
Header add MyHeader "Executei o htaccess...."
RewriteEngine on
RewriteRule ^assinatura\.gif$ send_email\.php [L]

The link are: [imoveisplus.com.br...]

What I'm doing wrong?

There are a way do start the php using the {THE_REQUEST} or {HTTP_REFERER} RewriteCond when the browser made the request for the image?

Thanks for all help and regards