2012-12-25 34 views
0

好的,這個問題可能看起來有點討論,但不幸的是我找不到自己的好答案。如何在htaccess中定義應用程序啓動文件

如何在每次向我的網站發出請求時運行我的web應用程序的啓動文件.htaccessZF使用application/index.php來定義所有全局變量,如:APPLICATION_ENV,include_path()WordPress這是否會加載必要的主題。

回答

1

說你想要的一切,通過/boot.php路由,那麼你會做下列操作之一:

RewriteEngine On 
RewriteCond %{REQUEST_URI} !^/boot\.php 
RewriteRule ^(.*)$ /boot.php [L] 

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /boot.php [L] 

您可以將其他參數傳遞給boot.php要麼通過_SERVER['REQUEST_URI']變量或通過查詢字符串:

RewriteRule ^(.*)$ /boot.php?path=$1 [L] 
1

下面是我在我的.htaccess文件:

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php/$1 [L] 

但我不知道有多好,是這樣的:我覺得有可能是案件佔不當。

相關問題