2015-10-27 100 views
0

這是我的鏈接:從URL中刪除index.php文件 - 笨

http://vitrinsaz1.ir/Mobile/Vitrinsaz/Pannel/index.php/welcome

我想從URL中刪除index.php文件。

.htaccess文件:

/潘內爾

的.htaccess

<IfModule mod_rewrite.c> 


RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www.vitrinsaz1.ir 
RewriteRule ^.*$ http://www.vitrinsaz1.ir%{REQUEST_URI} [R=301,L] 

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

</IfModule> 

$config['index_page'] = ''; 

$config['base_url'] = 'http://vitrinsaz1.ir/Mobile/Vitrinsaz/Pannel/'; 
+0

你對本地主機wamp xammp使用什麼? – user4419336

+0

嘗試用問號標記:'RewriteRule ^(。*)$ /index.php?/$1 [L,QSA]' – Tpojka

+0

檢查模式重寫是否啓用 –

回答

0

添加?在最後一條規則index.php後使你的.htaccess會像

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www.vitrinsaz1.ir 
RewriteRule ^.*$ http://www.vitrinsaz1.ir%{REQUEST_URI} [R=301,L] 

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

你可以試試這個設置;

$config['uri_protocol'] = 'REQUEST_URI'; 
$config['index_page'] = ''; 
$config['base_url'] = ''; 

而.htaccess;

<IfModule mod_rewrite.c> 
     RewriteEngine On 
     RewriteBase/

     # Removes index.php from ExpressionEngine URLs 
     RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] 
     RewriteCond %{REQUEST_URI} !/system/.* [NC] 
     RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] 

     # Directs all EE web requests through the site index file 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteCond %{REQUEST_FILENAME} !-d 
     RewriteRule ^(.*)$ /index.php/$1 [L] 
</IfModule> 

https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

,如果它不工作,嘗試此鏈接;

http://www.formget.com/codeigniter-htaccess-remove-index-php/