Basically use mod_rewrite to manage my 301 redirects, performs this happen before my page is offered? therefore if I in addition have a couple of redirect rules inside a php script that operates on my page, will the .htaccess start working first?

The .htaccess will start working first. Should you consider the Apache request cycle:

Apache Request Cycle

PHP is really a response handler. mod_rewrite runs at URI translation, aside from rewrite rules inshtaccess and <Directory> or <Location> blocks which run within the fixup phase. The reason being Apache does not know which directory it's in (and therefore which <Directory> or .htaccess to see) until after URI translation.

In reaction to to gabriel1836's question concerning the image, I snapped up it in the second slide of this presentation but it is initially in the book: Writing Apache Modules in Perl and C that we recommend.

Whenever a request is built to the URI impacted by the .htaccess file, then Apache will handle any rewrite rules before all of your PHP code executes.

Yes, the .htaccess file is parsed before your script is offered.

.htaccess happens first.

htaccess is controlled through the webserver. This file is going to be drawn in account before your PHP file.

For instance, you can restrict access to particular folder together with your htaccess file. So, it need to be consume charge before your PHP.

Hope this can help.

The .htaccess is carried out by Apache prior to the php script execution. (let's suppose the php script is performed and so the .htaccess create a redirection to a different page...).

You usually can test this using the following command:

wget -S --spider

With this particular command the thing is the who's reacting for your request.

As all of the others pointed out, .htaccess is first.