0

I have one issue I am using one .htaccess file form one year this code is working on all server but today I have one new server same code is not working. I am not able to remove index.php from URL. My server is Apache/2.2.15 (Red Hat). My code for .htaccess file

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 
<IfModule mod_headers.c>
Header add Cache-Control:  "no-store, no-cache, must-revalidate"
</IfModule>

In config file I set below settings

$config['index_page'] = ''; $config['uri_protocol'] = 'AUTO';

This same code is working on another server

4 Answers 4

0

Can you try like this: (but i'm not sure)

RewriteRule ^(.*)$ index.php/$1 [L]

I'm using Apache, too. My .htaccess:

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

<Files "index.php">
AcceptPathInfo On
</Files>
Sign up to request clarification or add additional context in comments.

1 Comment

0
  1. load the "mod_rewrite.so" in http.conf;
  2. replace AllowOverride "None" with "All"
  3. try those code in .htaccess: enter image description here

2 Comments

Sorry I can not understand first and second step
step1 means you must open your rewrite module before using it. Just edit the apache configuration file - "http.conf", and remove the "#" before this line - "LoadModule rewrite_module module/mod_rewrite.so", and restart your server.
0
  1. Make sure you have mode_rewrite enabled from apache, debian server you can run a2enmod rewrite

  2. Try the following htaccess, it worked for me when I encountered same problem

Htaccess

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

Goodluck :)

Comments

0

Use following code:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

I hope this will help you.

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.