1
我試圖將我所有的.less
文件路由到一個php文件進行處理。 php文件獲取.less
文件網址並返回處理text/css
。如何處理通過服務器路由收到的php文件?
我有這行我.htacces
文件:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} (\.less)$
RewriteRule (.*) renderless.php?url=$1 [QSA]
</IfModule>
上述工程預期和路由.less
文件到PHP。
我用這條線來獲取URL在PHP(heres the full code):
$file = $_SERVER['HTTP_HOST'] . '/' . $_GET['url'];
// .. some lines later
$css = file_get_contents($file);
但是!的PHP拋出一個錯誤,因爲它無法找到文件少:
load error: failed to find local.mysite.com/css/main.less' in ...
如果我手動發送在php處理器工作的路徑。
- 我在
htaccess
文件中做錯了什麼? - 問題在PHP?
我從該重寫規則中收到錯誤..'找不到對象! – hitautodestruct
嗯不知道是否有錯誤嘗試:'RewriteRule ^(。+?\。less)$ renderless.php?url = $ 1 [L,QSA,NC]' – anubhava
對不起,我的壞。只需複製粘貼。重寫規則的作品,但PHP仍然拋出一個錯誤''http://' – hitautodestruct