Codeiginter product worked well in localserver without index.php but not worked in server

核能气质少年 提交于 2019-12-07 19:13:49

问题


I have created one project in codeiginiter

That was worked in local server without index.php (localhost/sample) But when i up-ed into online server(cpanel linux) the default controller only worked , other next page URLs are not worked.. (https://sample/nextpage)

if i give index.php means worked (https://sample/index.php/nextpage)

i want to remove index.php , please help me..

my config.php

$config['index_page']   = 'index.php';
$config['uri_protocol'] = 'REQUEST_URI';

my route.php file

$route['default_controller'] = "pages/home";
$route['pages/profile'] = "pages/profile"; 
$route['creators'] = "pages/userList";
$route[$username] = "pages/userList/userview/$1"; 

$route['translate_uri_dashes'] = FALSE;
$route['404_override'] = '';

my .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 
Options All -Indexes 

Thanks in Advance,

Shruthi.


回答1:


Try to change the code of your .htaccess file with the following

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



回答2:


Change .htaccess file

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



回答3:


try this

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond $1 !^(index\.php|img|css|public|tmp|download|javascript|rte|document|xajax_js|robots\.txt)



回答4:


Please contact your hosting provider and check mod_rewrite module is enable or not?



来源:https://stackoverflow.com/questions/36906066/codeiginter-product-worked-well-in-localserver-without-index-php-but-not-worked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!