簡體   English   中英

使用共享托管在GoDaddy上托管Codeigniter網站

[英]Hosting Codeigniter site on GoDaddy with shared hosting

目錄結構( public_html

public html
htpasswds
application
    .htacess
cgi-bin
system
user_guide
index.php

配置文件如下所示:

$config['base_url'] = 'http://www.example.com/index.php/';
$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'AUTO';
$config['allow_get_array']      = TRUE;
$config['enable_query_strings'] = FALSE;

.htaccess文件

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

route.php

$route['default_controller'] = 'welcome';

application->controllers我有兩個PHP文件, welcomeabout在它們的方法。

以下是我正在生成的鏈接,它們是

<li><a href='./welcome'>Home</a>
<li><a href='./welcome/first'>first</a></li>    
<li><a href='./welcome/second'>second</a></li>
<li><a href='./third'>Third</a></li>
<li><a href='./fourth>Four</a></li>
<li><a href='./five'>Five</a></li>
<li><a href='./six'>Six</a></li>

如果我手動輸入http://www.example.com/index.php/welcome/second ,則可以訪問該頁面。 但是我不知道如何生成相同的鏈接,以及如何擺脫URL中的index.php

最好使用Anchor函數來生成鏈接。 請參閱此處的文檔。

htaccess應該在網址之前刪除index.php,並且您應該將此行更改為:

 $config['index_page'] = ''; 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM