Page 1 of 1

Ignore existing files/folder with.htaccess

Posted: Tue Dec 22, 2009 10:16 pm
by alex.barylski
I have the following which works:

Code: Select all

RewriteEngine on
RewriteBase /
 
RewriteCond %{HTTP_HOST} ^pcspectra.com [NC]
RewriteRule ^(.*)$ http://www.pcspectra.com/$1 [L,R=301]
 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,NC,L]
The last 3 lines are what I probalby want to comment out, but I think this would mean I would have to handle image requests and everything which I do not want to do. I have an index.php in a root directory and some custom scripts in a sub-directory which are invoked like:

Code: Select all

scripts/add_contact.php
scripts/add_contact.php?dept=3&owner=4
I would like to intercept these requests and perform custom processing and then continue letting each handle the request from there on in. Do I have to emulate an HTTP request forward or something internally within my own index.php located in the root directory?

Is there an easy way to perform this request, basically just catching the request (doing my thing) then emulating/copying the exact request by forwarding the HTTP request exactly as it was intercepted???

Even if I had to execute an binary or something so I don't have to implement an HTTP client inside my index.php that would be awesome...

Any ideas?

Cheers,
Alex

Re: Ignore existing files/folder with.htaccess

Posted: Tue Dec 22, 2009 10:17 pm
by alex.barylski
Also, what would I add to the .htaccess file in order to continue normally for everything other than *.php extensions and quite possibly only a few limited scripts or queries to boot?

EDIT | Please do not confuse HTTP request forward with a forward VS redirect at the controller level. I need to literally forward an entire HTTP request onto a third party script which when invoked will have no clue it's been executed by a emulated server or whatever solution I decide on.

Cheers,
Alex