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

[eluser]jjhii[/eluser]
One of our clients is all SEO happy Sad

Anyways one of the SEO test sites they use shows that http://www.site.com = http://www.site.com/index.php and it is considered a duplicate. Same place so of course it is but... This seems the last error to fix.

Any suggestions on how to get around this. 301 redirect seems best, was thinking just look at the URI and force it but if there is a better way would like to do that instead.

Thanks
#3

[eluser]jjhii[/eluser]
Thanks for the suggestion, I was more hoping to disable index.php as a choice so I guess I will go with the ugly code method.

if(stristr($_SERVER["REQUEST_URI"], "index.php") !== FALSE)
{
redirect(site_url(), 'refresh', '301');
}


#4

[eluser]Aken[/eluser]
Do it in your .htaccess file. No need for server side code.

Ideally, a search engine would never know that the index.php version exists, so long as it is not linked to anywhere on your site.
#5

[eluser]jjhii[/eluser]
well yea and if I knew how to do that I would not have asked Wink

I guess I could change the startup from index.php to something creptic so the SEO test would not think to look at it. but when I try to force the index.php out it does a 500 error. I have been reading stuff on .htaccess but so far I have not seen an obvious way of doing it. this is what I have below...

Code:
RewriteCond $1 !^(index\.php|images|css|docs|script|blog|ckeditor|docs|blog|robots\.txt|BingSiteAuth\.xml)
RewriteRule ^(.*)$ ./index.php?/$1 [L]
#6

[eluser]Aken[/eluser]
I don't advocate actually using this, but if you want the .htaccess solution, put this line above what you have:

Code:
RewriteRule ^index.php$ http://www.example.com [R=301,L]

Personally you should look into the canonical <link> tag as was linked previously, and avoid linking to index.php, so people and engines will never know it exists.
#7

[eluser]jjhii[/eluser]
Thanks I will look into it.

I don't link to index.php anywhere on my site. The only reason this is an issue is because the client went to one of those SEO testing sites which puts in common links and reports back issues. It seems my custom 404 was not returning correctly either for default.asp amoung other things but that is fix now too.




Theme © iAndrew 2016 - Forum software by © MyBB