0

I uploaded codeigniter project on server.Removing index.php from URL is not working. I access it using IP address. like http://ip address/

Below is my htaccess

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

/etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

I tried all possible solutions found on google. but not working for me.

4 Answers 4

2

Please follow some step:

  1. goto application/config/config.php : replace $config['index_page'] = 'index.php'; to $config['index_page'] = ''; and $config['uri_protocol'] = 'REQUEST_URI'; to $config['uri_protocol'] = 'AUTO';

  2. enable rewrite mode by
    sudo a2enmod rewrite then service apache2 restart

  3. if you'd like, you can use the following .htaccess file.

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

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

Comments

0

in httpd.conf, edit or delete "index.php":

<IfModule dir_module>
     DirectoryIndex index.php
</IfModule

Then in htaccess, add this:

Options -Indexes

1 Comment

I can not finf httpd.conf only apache2.conf is there in /etc/apache2
0

Add below code in .htaccess. Hope this work.

Options All -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

2 Comments

Still same issue
Open config.php and replace with blank $config['index_page'] = "";
0

Set your .htaccess as below

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

Then open /etc/httpd/conf/http.conf file and find <Directory "/var/www/html"> with in this find and set AllowOverride None to AllowOverride All.

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.