I would like to try to understand some of my htaccess rules but I can't succeed to find the proper documentation.
RewriteRule ^([a-z]{1,2})?\/?style\/(.*).css$ site/scripts/concat-files.php?type=css&page=$2&lang=$1 [L,QSA]
Question 1: I guess this rule is triggered by something like this. <link rel="stylesheet" src =<?php echo URL ?>"/en/style/accueil.css">
Am I right ?
Question 2: I know QSA allow to keep the request parameter from the first url to the rewrite URL. But what L is doing ?
Question 3 : Is the rule triggered by this kind of things ?
$urlstyle = URL."en/style/accueil.css";
$style = file_get_contents($urlstyle);
Thanks.
EDIT: Then considering this
$urlstyle = URL_SITE.'en/style/accueil.css';
$style = file_get_contents($urlstyle);
echo $style;
The style is written.
But in my concat-files.php
I have this
$pathfile= PATH . $file;
$sContenu = @file_get_contents( $pathfile);
if( $sContenu !== false) {
echo $sContenu;
}
It means that accueil css will be written 2 times no ?
But in my code I have it only once.
Edit
As @nick said in the comments
1 - The rule is triggered by any http request that satisfy the rule itself. or rather :
`1 or 2 alphabetic characters` / style / `any string`.css
2 - [L]
means thats only first rule will apply, other rules match will be ignored.
3 - Yes, as i said The rule is triggered by any http request that satisfy the rule itself
Edit2
No, it seems that you are not outputting same content two times.
$style = file_get_contents($urlstyle);
You are assigning to $style
the content of an url (generated by some php code). Is a different behaviour from, for example, include
function, in that case both pieces of code would be executed and written two times.
So its ok that you have it only once.