1

I need to redirect the below url

http://localhost/CodeIgniter/index.php?/Welcome/

to

http://localhost/CodeIgniter/Welcome/

and I have tried the below in .htaccess

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php($|\ |\?)
RewriteRule ^ /%1 [R=301,L]

The above code taken me to below

http://localhost/CodeIgniter/?/Welcome/

I need to remove that ? mark for avoiding duplicate urls in seo. Can anybody help me

Vinu
  • 167
  • 4
  • 14

2 Answers2

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

And you have to enable mod_rewrite
If you are using PHP version lower than 5.2.6 -> Remove the ? from index.php

0

You can try your code this way.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?/(.*)
RewriteRule ^ /%1? [R=302,L]
Panama Jack
  • 24,158
  • 10
  • 63
  • 95