2

I have a CI installation which has routes

$route['signin']="auth/login";
$route['logout']="auth/logout";
$route['signup']="auth/register";

my ci installation resides inside www.domain.com/app/

when i goto this url , it routes to www.domain.com/app/signin/ but it shows

The requested URL /www.domain.com/app/signin was not found on this server.

but when i manually insert index.php

www.domain.com/app/index.php/signin

then it opens.

What can be the issue?I have configured htaccess.

This ci installation was in another server and I transafered it to this new server.I kept the base url blank.

htaccess code is

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
5
  • 1
    where is the .htaccess code Commented May 19, 2014 at 10:09
  • Have step by step solution:sforsuresh.in/… Commented May 19, 2014 at 10:15
  • Sometimes it depends on your hosting server. Could you please mention your hosting server provider name. Commented May 19, 2014 at 10:19
  • Then your .htaccess looks good. May be you have some other issue. Commented May 19, 2014 at 10:23
  • @user3637105 set RewriteBase/app/ to your subdirectory Commented May 19, 2014 at 10:25

3 Answers 3

3

This ci installation was in another server and I transferred it to this new server.

Based on it working on another server, it appears the new server does not have the AllowOverride Apache setting configured to enable the htaccess, meaning your htaccess is disabled or ignored. Or the new server is a non-Apache web server, which doesn't recognize htaccess at all.

Sign up to request clarification or add additional context in comments.

3 Comments

Mine is apache.SO how do I enable the htaccess ?Any?
Click on the AllowOverride link in the answer for how to enable it. To give full access for htaccess, use AllowOverride All in your httpd.conf file (in the <Directory> section).
This is it, ESPECIALLY if it's an AWS EC2 server. This video shows how to change it quickly with SSH ... youtube.com/watch?v=44vXMxHThT0
1

You need update config.php to this

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://domain.com/app/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = ''; // Remove index.php

Now .htaccess

RewriteEngine on

# RewriteBase /
RewriteBase /app/

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Comments

0

Try this :

RewriteEngine on
RewriteBase/app/

# Add www in the start of URL if user leave
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Prevent CI index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

# Prevent user access to the CI system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Prevent user access to the CI application folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

set RewriteBase like this RewriteBase/app/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.