0

i am using CI version 3.1.0

and inside my httacces file like this

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

and i have change my config file to $config['index_page'] = ''

i'ts work but CI seem cant find controller that request fromm url. example localhost/site/index.php/welcome its work as expected, but when request it with localhost/site/welcome i got 404 page not found.

areiilla
  • 107
  • 2
  • 7

3 Answers3

1

Could you try replacing the last line with

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

It depends a bit on the hosting, too I've noticed so this might not work. Is mod_rewrite or equivalent enabled?

If your application is running inside the directory /site/, what did you put in $config['base_url']?

qwertzman
  • 784
  • 1
  • 9
  • 23
  • $config['base_url']='' and my site just running on localhost. my otherproject with previous ci can run well with that mod. i don't understand what happened really – areiilla Dec 27 '16 at 16:08
  • is it running on localhost or on localhost/site? maybe try `$protocol = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://'; $config['base_url'] = $protocol . $_SERVER['HTTP_HOST'] . str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);` – qwertzman Dec 27 '16 at 16:12
0

I'm using this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
B. Assem
  • 1,058
  • 9
  • 12
  • none... none of them work. i am just tryng everyting combination in htaccess folder. better leave them and start new project with latest codeigniter... and viola it's work... – areiilla Dec 27 '16 at 17:38
0

If you already follow this: tutorial, you need to set the AllowOverride directive to all in the path where your app is located. It is necessary because you are using an , .htaccess file. More.

When this directive is set to None and AllowOverrideList is set to None, .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

Remember:

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.

It is an developer recommendation: Here is.

Community
  • 1
  • 1
ShutUpMagda
  • 171
  • 2
  • 12