1

I put code in .htaccess under is htaccess code and also change in config.php file but still it gives 404 error please any one help me to find what was the issue in that hear is the link of site http://198.12.149.211/~physrec/

$config['base_url'] = "http://198.12.149.211/~physrec/";

    <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /ci_intro/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]


</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>   
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • If you want to remove index.php from your URLs , then make sure to do the following in application/config/config.php - $config['index_page'] = '' – pankaj Jun 18 '14 at 07:05
  • i just put $config['index_page'] = '' but it is not working still – user3751235 Jun 18 '14 at 07:11
  • Just now, i clicked on the above link, the page is opening and I am not getting 404 error. – pankaj Jun 18 '14 at 07:14
  • home is open but other menu page is not working that gives 404 – user3751235 Jun 18 '14 at 07:18
  • Modify your rewrite rule and remove /ci_intro/ from there.. e.g. your last rewrite rule should be - RewriteRule ^(.*)$ index.php?/$1 [L] – pankaj Jun 18 '14 at 07:22
  • RewriteBase '/ci_intro/' is become only '/' ? you meanes where ci_intro found it will removed – user3751235 Jun 18 '14 at 07:28
  • No, there is no need of '/' here, just try this: "RewriteRule ^(.*)$ index.php?/$1 [L]" – pankaj Jun 18 '14 at 07:30
  • nup dud not working ? RewriteBase /ci_intro/ is removed from in htaccess – user3751235 Jun 18 '14 at 07:36
  • I think you are doing the wrong change, dont modify RewriteBase, that is required, you just have to modify your RewriteRule. Let me rewrite the .htaccess file in an answer. – pankaj Jun 18 '14 at 07:38

2 Answers2

0
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /ci_intro/

   #Removes access to the system folder by users.
   #Additionally this will allow you to create a System.php controller,
   #previously this would not have been possible.
   #'system' can be replaced if you have renamed your system folder.
   RewriteCond %{REQUEST_URI} ^system.*
   RewriteRule ^(.*)$ index.php?/$1 [L]

   #When your application folder isn't in the system folder
   #This snippet prevents user access to the application folder
   #Submitted by: Fabdrol
   #Rename 'application' to your applications folder name.
   RewriteCond %{REQUEST_URI} ^application.*
   RewriteRule ^(.*)$ index.php?/$1 [L]

   #Checks to see if the user is attempting to access a valid file,
   #such as an image or css document, if this isn't true it sends the
   #request to index.php
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule> 

Make sure you have the following in your httpd.conf file, if not then modify your conf file and restart apache.

 <Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
 </Directory>

Also, make sure rewrite is on in your apache configuration

pankaj
  • 1,316
  • 3
  • 16
  • 27
0

Change your .htaccess file to,

RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Change your config file from,

$config['index_page'] = "index.php";

to,

$config['index_page'] = "";

Also this example will be helpfull, http://snipplr.com/view/5966/codeigniter-htaccess/

dipak_pusti
  • 1,645
  • 2
  • 23
  • 42