我正在使用Codeigniter 2.0.3 | Apache 2.2.17 | PHP 5.3.4。Codeigniter .htaccess:公開訪問「公共」文件夾內的所有文件和文件夾
我想給予訪問「公共」文件夾內的所有文件和子文件夾。我已閱讀了Codeigniter wiki中的文章以及谷歌搜索結果中的所有前5個頁面,並沒有發現任何可行的方法。
這是文件樹:
- application
- public
- css
- style.css
- img
- js
- system
- .htaccess
這是我使用從URL中移除「的index.php」,並嘗試給訪問該文件夾中的.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CodeIgniter_2.0.3
#Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#Enable access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|public|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
該網站工作和'index.php'不再需要的URL,但最後一個條件應該提供訪問公用文件夾,但它不適合我,所以這個http://localhost/CodeIgniter_2.0.3/public/css/style.css
文件未找到。
在config.php我有:
$config['base_url'] = 'http://localhost/CodeIgniter_2.0.3/';
$config['index_page'] = '';
請幫助。 謝謝!
哪個文件夾是您的DocRoot?我假設它是'公共'? – swatkins