我測試了我的網站很多次,但我無法解析Page not found錯誤。 井,Codeigniter視圖可用,但仍然收到頁面未找到錯誤
1步驟:創建一個控制器和所謂welcomelogin.php - 其中I存儲兩個功能
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class WelcomeLogin extends CI_Controller {
public function index()
{
$this->home();
}
public function home(){
$this->load->helper('url');
$this->load->view('login');
}
public function inside(){
$this->load->helper('url');
$this->load->view('inside');
}
2-步驟:以我rote.php文件I簡單執行follwing:
$route['default_controller'] = "welcomeLogin";
$route['404_override'] = '';
3步:內部視圖文件夾我創建兩個文件一個是login.php &第二是inside.php與login.php包含登錄窗體和inside.php包含簡單的HTML。
現在我得到了登錄頁面,我的網站的主頁面是工作的罰款: http://localhost/website/Codeigniter_Project/MyProject/
當我做下面我得到找不到網頁錯誤: 我試着用兩種方式無一不給了我同樣的錯誤:
1-ST的方式:通過直接捐贈視圖名稱和結果頁面沒有找到 本地主機/網站/ Codeigniter_Project/MyProject的/內
2擋的方式:通過給控制器的名稱,然後查看,但結果頁面未找到 本地主機/網站/ Codeigniter_Project/MyProject的/ welcomelogin(controllername)/內
請幫助我,因爲我通過搜索和應用不同的答案花了近2小時,是有堆棧類似的問題和一些有我已經嘗試過的答案但沒有工作&那些問題是有點不同,那麼我的。感謝您的時間夥計。:)我在本地主機服務器上運行,並且我的apache mod_rewrite已打開。謝謝。 &我是新來的笨感謝
我的.htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /website/Codeigniter_Project/MyProject/
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
什麼BASE_URL? – Arun 2015-03-19 04:47:21
inside - 不工作 – user2268488 2015-03-19 04:52:50