我閱讀了大量mod_rewrite的爲笨的其中很多東西都在談論創建.htaccess文件,並在文件中像與codeigniter mod_rewrite發生頭痛〜!
我和笨初學者,所以我從YouTube教程學習。 起初,我只安裝了apache 2.2來運行我的php,並使用mod_rewrite codeigniter後,我意識到它更容易安裝wamp,所以我卸載了apache,然後安裝了wamp,其中包含了一切。
之後,我繼續在youtube上關於mod_write的教程。我用wamp激活了模塊。
創建內部ci_intro這個.htaccess文件是根文件夾
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#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]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
我去到config/config.php文件,改變
$config['index_page'] = '';
事情沒有工作。我得到了404error當時我在
RewriteBase /ci_intro/
嘗試一些東西,甚至還刪除了整個項目,因爲我支持的東西之前,我嘗試mod_write。即使在我檢索了備份之後。我仍然沒有得到error404頁面。
我只是不斷獲取..
由於我使用WAMP,當我去我的本地有一個部分說我的項目,該項目ci_intro ......我一下就可以了上面的圖片出來了。 我把我的鼠標來檢查什麼的鏈接顯示當鼠標懸停和鏈接顯示
[CODE] http://localhost/ci_intro[CODE]
任何人都知道這是怎麼回事呢?
當我進入C:\ WINDOWS \ SYSTEM32 \ DRIVERS \等\主機 這是我看到 127.0.0.1本地主機 127.0.0.1 \t mpa.one.microsoft.com 127.0.0.1本地主機 127.0。 0.1本地主機 雖然 – Dora
@ user1850712,所有其他註釋掉,添加行:「127.0.0.1 www.domain.tld」,保存文件,然後關閉您的瀏覽器(所有標籤和窗口)。這將導致您的瀏覽器將您的虛假域名解析爲本地系統IP(始終爲127.0.0.1)。 – rightstuff
剛剛嘗試過,但它只會將我帶回本地主頁,並在URL中顯示www.domain.tld而不是localhost。 – Dora