Nisarg
Nisarg

Reputation: 3262

Codeiginter : Error in URL

My front url is-

http://localhost/myProject/

admin url is -

http://localhost/myProject/admin

It works in windows but not works on Ubuntu.

It gives error "Not found".

What works in ubuntu -

The front page is working - http://localhost/myProject/

The admin login page is working if I add index.php in url like this - http://localhost/myProject/index.php/admin

Not other pages are working

My .htaccess file contents-

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|themes)
RewriteRule ^(.*)$ /myProject/index.php/$1 [L] 

My Apache's mod-rewrite module is on.

Upvotes: 1

Views: 59

Answers (1)

aug born
aug born

Reputation: 346

I was also following the similar issue in Centos, and I followed the below tutorial :

How to permit changes in the .htaccess file:

open httpd using ------------------> vi /etc/httpd/conf/httpd.conf

Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:

<Directory /var/www/>
      Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
           allow from all
</Directory>

After you save and exit that file, restart apache. .htacess files will now be available for all of your sites.

service httpd restart

Content of .htaccess file:

<IfModule mod_rewrite.c>

    Options +FollowSymLinks -Indexes
    RewriteEngine on

    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /

    # Restrict your site to only one domain
    #RewriteCond %{HTTP_HOST} !^www\.
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond $1 !^(index\.php|images|fonts|js|images|robots\.txt|css)
    <IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>

</IfModule>

#prevent access to htaccess file
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

#disable directory browsing
Options All -Indexes
IndexIgnore *

Upvotes: 0

Related Questions