2013-09-01 19 views
0

我爲我的應用程序使用ZF1,下面是我的.htaccess文件,它位於/ public文件夾中。如何爲cronjob應用.htaccess規則?

.htaccess 
---------------------------- 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

Folder Structure 
------------------------------------  
/application 
/public 
index.php 
/scripts 
cronjob.php 

目前,有什麼發生的所有請求重定向到的index.php文件。我想/cronjob.php請求重定向到/scripts/cronjob.php文件。我該如何處理.htaccess?

感謝,Jimit

+0

如果cronjob運行在同一臺服務器上,則不需要任何規則,因爲它不使用瀏覽器訪問腳本,而是訪問本地路徑。 – Prix

回答

0

寫這個規則之前index.php文件重定向規則:

RewriteRule ^cronjob.php$ /scripts/cronjob.php [NC,L] 

重寫引擎將STOP L指令執行後,這樣用戶將被重定向到正確的URL。