RNK
RNK

Reputation: 5792

Codeigniter URLnot found

I am using Codeigniter framework in PHP. My website is on apache server. Path: /var/www/example.com/public_html

.htaccess

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

But still I am getting this error on accessing this page: www.example.com/test/wallet:

The requested URL /test/wallet was not found on this server.

SCREEN SHOT

enter image description here

When I use www.example.com/index.php/test/wallet, then it's working...

Upvotes: 0

Views: 122

Answers (3)

RNK
RNK

Reputation: 5792

I think all of your .htaccess setting are correct. I used @Nassim's solution.

Originally, Problem was with the configurations in apache2.conf file. I just set AllowOverride All in /var/www and activated rewrite on server by this command:

sudo a2enmod rewrite

Then I restarted my server: sudo service apache2 restart

Thanks to every1 for support.

Upvotes: 0

Abdulla Nilam
Abdulla Nilam

Reputation: 38609

problem is with your URL rewrite.

place this outside application folder

File name = .htacess

in side

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

Upvotes: 1

Nassim
Nassim

Reputation: 2876

this is my .htaccess that works on both wamp and live linux server running Centos + Apache and Ubuntu +apache

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /path-to-code-igniter-directory/index.php/$1 [L]

# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

I also made a video on how to do this here

https://www.youtube.com/watch?v=v-4VkR54vLU

(skip to 28:50 to see the .htaccess .I also put it in the description under the video)

hope that helps

Upvotes: 1

Related Questions