我是新的CodeIgniter和index.php是一個痛苦的屁股。如何重定向index.php與CodeIgniter是一個子頁面
我想要一些友好的網址,但我的網站位於子文件夾中。
我安裝了乾淨的CodeIgniter安裝,爲測試目的添加了另一個視圖,這就是我所得到的。
Page 1
http://www.example.com/webadmintest/
http://www.example.com/webadmintest/index.php/welcome/index
Page 2
http://www.example.com/webadmintest/index.php/welcome/byebye
這是完美的。
現在,在配置文件中我改變了這個:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
,並在應用程序文件夾中添加.htacces這(我不知道這是地方或根笨文件夾)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
我stil可以加載之前的鏈接,但如果我嘗試去這個鏈接,它會將我發送到主www.example.com頁面。
Page 1
http://www.example.com/webadmintest/
http://www.example.com/webadmintest/welcome/index
Page 2
http://www.example.com/webadmintest/welcome/byebye
我也嘗試使用:
$config['base_url'] = '/webadmin/';
和
RewriteBase /webadmintest/
和
RewriteRule ^(.*)$ /webadmintest/index.php?/$1 [L]
正如你可以看到這是不是典型的問題,我的意思是可能如果這是一個獨立的網站我p robably不會有這個問題,但需求需要網站成爲主要網站的子文件夾。
感謝
可能重複[刪除的index.php從URL - 笨2](http://stackoverflow.com/questions/5155333/remove-index-php-from-url-codeigniter-2) –
你想刪除文件index.php或者你只是想從網址中刪除? –
我希望它從URL中刪除 – bucur89