0

I am having trouble to generate redirection rule I tried so many possible ways but those are not working. Here are the details:

1) Current link: https://app.abcd.com (Showing in url)

2) Redirect to: https://app.abcd.com/index.php/login

3) Should be renamed as : https://app.abcd.com/login

I have tried :

RewriteEngine on
RewriteRule (.*) http://https://app.abcd.com/index.php/login/$1 [R=301,L] 

Didn't work!

Any help!

Nikhil Vaghela
  • 2,088
  • 2
  • 15
  • 30
Akshay
  • 700
  • 9
  • 23
  • http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url please check this link – kuldeep Aug 09 '16 at 09:41

6 Answers6

0

Try it.

Options +FollowSymlinks
Options -Indexes

<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>
RewriteEngine on



RewriteBase /example/  



RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) index.php/$1 [R=301]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)/([^?]*) index.php?_cmd_=$1/$2  [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_cmd_=$1  [L,QSA]
Neeraj Prajapati
  • 541
  • 5
  • 24
0

HTACCESS

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

Open config.php and do following replaces

$config['index_page'] = "index.php"
Nikhil Vaghela
  • 2,088
  • 2
  • 15
  • 30
kuldeep
  • 218
  • 1
  • 10
0

.htaccess for codeigniter:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

And in config.php:

change:

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

to:

$config['index_page'] = "";
Arkadiusz G.
  • 1,024
  • 10
  • 24
0

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

Swapnil Mahadik
  • 640
  • 5
  • 3
  • Welcome to Stack Overflow! While this code snippet may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – Jonathan Lam Aug 09 '16 at 14:06
0

Try to add this in your .htacces file:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

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

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
Pardeep Pathania
  • 1,378
  • 2
  • 15
  • 23
0

You can use this :

RewriteEngine on

RewriteRule ^$ /index.php/login [L,R]

This will redirect your homepage / to /index.php/login

You can also accomplish this using RedirectMatch

RedirectMatch 301 ^/$ /index.php/login/
Amit Verma
  • 40,709
  • 21
  • 93
  • 115