从url中删除index.php文件 - Codeigniter

this is my link :

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

I would like to remove index.php from url.

my .htaccess file :

/Pannel

.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/';
dsstjqsr631426
dsstjqsr631426 检查模式是否重写启用
接近 5 年之前 回复
duanlushen8940
duanlushen8940 尝试使用问号:RewriteRule^(。*)$/index.php?/$1[L,QSA]
接近 5 年之前 回复
dongyikong6207
dongyikong6207 你对localhostwamp,xampp有什么用?
接近 5 年之前 回复

3个回答



试试这个</ p>

  RewriteEngine On 
RewriteCond%{REQUEST_FILENAME}!-f \ nRewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ index.php / $ 1 [L]
</ code> </ pre>

更多阅读 http://w3code.in/2015/09/how -to-remove-index-php-file-from-codeigniter-url / </ p>
</ div>

展开原文

原文

Try this

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

for more read this http://w3code.in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/

dot_0620
dot_0620 codeigniter.com/userguide3/general/urls.html
接近 5 年之前 回复
dongruan6001
dongruan6001 没有改变。 我以前缝过它。
接近 5 年之前 回复



在最后一条规则中的 index.php </ code>之后添加?</ code>,这样你的.htaccess就会 就像</ p>

  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]
</ code> </ pre>
</ div>

展开原文

原文

Add ? after index.php in last rule so your .htaccess would be like

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]

You can try this settings ;

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

And .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

if it does not work try this link ;

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐