2016-07-29 45 views
-1

在mathwork文件夾我的笨項目 mathwork是另一個文件夾管理已經笨文件 admin管理員文件夾裏面的文件夾中有一個笨文件庫中所有有如何刪除的index.php在笨項目

mathwork 
    --admin 

當我想嘗試訪問作爲

http://localhost/mathwork/admin/authorize/add 

它顯示錯誤404

當我嘗試到作爲CCESS

http://localhost/mathwork/admin/index.php/authorize/add 

其做工精細

如何刪除index.php文件,並得到URL作爲

http://localhost/mathwork/admin/authorize/add 
+0

您需要啓用網址在你的網絡服務器重寫,並通過你'web.config'配置它( IIS)或'。htaccess'(apache)或其他配置您的網絡服務器使用 – mituw16

+0

**閱讀手冊:** [從URL中刪除'index.php'](http://www.codeigniter.com/user_guide/general/urls.html#刪除這個索引的php文件) – Sparky

+0

可能的重複[如何從CodeIgniter的URL中刪除'index.php'?](http://stackoverflow.com/questions/2192136/how-do-i-remove -index-php-from-url-in-codeigniter) – Sparky

回答

0

我使用WAMP和XAMPP和Windows 10

這的.htaccess似乎很好地工作,我

Options +FollowSymLinks 
Options -Indexes 
DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

廣場htaccess的出應用程序文件夾的側

  • yourproject
  • 您的項目> admin < - 應用程序文件夾
  • yourproject>管理員>的.htaccess
  • yourproject>管理員>的index.php you may need to change the system ../system

  • yourproject
  • yourproject>前端< - 應用程序文件夾
  • yourproject>系統
  • 您的項目> .htaccess
  • 您的項目>我ndex.php

在config.php文件

$config['base_url'] = 'http://localhost/yourproject/'; 
$config['index_page'] = ""; 

,您可以得到更多的.htaccess here

0

創建一個名爲.htaccess文件(如果Apache)在相同的目錄中index.php,打開它並添加:

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

下一個打開config.php並將$config['index_page'] = "index.php"更改爲$config['index_page'] = ""

您的網址現在應該在地址欄中沒有index.php的情況下運行。

+0

對我不起作用我在你寫這裏但是不工作codeigniter文件是在mathwork文件夾裏面和mathwork文件夾裏有admin文件夾在這個文件夾裏有codeiniter文件和我使用REQUEST_URI –