Welcome Guest, Not a member yet? Register   Sign In
removing index.php
#1

[eluser]Ajaxian64[/eluser]
Hello,

I have successfully remove index.php from the url thanks to .htaccess and $config file as discribed in many other post and CI wiki articles.

Then, when I enter http://mywebsite/controller1/method2 it works fine and index.php does not appear.

Nevertheles, when I enter http://mywebsite/index.php/controller1/method2 it also works.
My problem is that I want to redirect the last url to the first one with R=301 but I can't find the good .htaccess rule.
My problem is to avoid "SEO duplicate content"

Does someone know how to deal with that ?

Thank in advance
#2

[eluser]Buso[/eluser]
try this

Code:
RewriteRule ^index\.php\/(.*)$ $1 [R=301,L]
#3

[eluser]Ajaxian64[/eluser]
Thank you Buso

It works fine.

I was very far from the solution with the .htaccess rule

Many thanks
#4

[eluser]Ajaxian64[/eluser]
Sorry Buso

But for specific case http://mywebsite.com/index.php I have not a 301 to http://mywebsite.com

And I don't understand why because your rule works great for other cases...
#5

[eluser]Ajaxian64[/eluser]
I use this

But I 'm not so confident with my solution (I'm newbie with htaccess rules)

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

And it seems to work (pray :roll:
#6

[eluser]Ajaxian64[/eluser]
No sorry
don't work (I had problem with browser cache)
#7

[eluser]Ajaxian64[/eluser]
http://mywebsite.com/index.php/controller1/method1 =>301=> http://mywebsite.com/controller/method1 =>it is ok

I definitively don't know how to achieve this
http://mywebsite.com/index.php =>301=> http://mywebsite.com => it is NOT ok




Theme © iAndrew 2016 - Forum software by © MyBB