• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search engines indexation

#1
[eluser]Unknown[/eluser]
Hi,

I have a SEO problem here... When someone is accessing the site the page showing is /index.php/home, rather than only index.php. This redirection is loosing the SE crawlers, because there's nothing ont he index page.

Is there a simple way to make /index.php/home page to be the default page when someone is accessing the site?

If you need to see codes, let me know what you need. Thanks

#2
[eluser]Unknown[/eluser]
While reading the documentation I think I have found a partial answer to my question. The default page can be set in routes.php.

Right now the default page is called "welcome.php" (you can see the code of this page below) and this is the page redirecting to the /home page. The thing is that on the welcome.php page there's some cookies settings that are loaded before accessing the /home page...

Now the question is: can I put the cookies settings on the same /home controller page?

Here's the welcome.php code:

Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        if (isset($_COOKIE['lang']) && $_COOKIE['lang'] != "") {
                $this->session->set_userdata(array('lang' => $_COOKIE['lang']));
            }
        
            if ($this->session->userdata('lang') === FALSE) {
                $this->config->load('settings');
                $langs = $this->config->item('lang');
                    echo '
                        
                            checker = false;
                            theLang = "";
                        </script>
                                ';
                foreach ($langs as $lang) {
                    echo '
                        
                            language=(navigator["language"])?navigator["language"]:navigator["userLanguage"];
                        
                            myregex_' . $lang . ' = RegExp("' . strtolower($lang) . '");
                            
                            mymatch_' . $lang . ' = myregex_' . $lang . '.exec(language.toLowerCase());
                            if (undefined != mymatch_' . $lang . ') {
                                //alert("Match for: " + language);
                                checker = true;
                                theLang = "' . $lang . '";
                            } else {
                                //alert("No match");
                            }
                        </script>
                                ';
                }
                
                echo '
                    
                        //alert(theLang);
                        if (theLang == "") {
                            theLang = "' . $this->config->item('defaultlang') . '";
                        }
                        [removed] ="lang=" + theLang + "; expires=Thu, 7 Jan 2010 20:47:11 UTC; path=/";
                    </script>
                            ';
            } else {
                //echo "yeah";
            }
            
            echo '
                
                    document.location.href="' . base_url() . 'index.php/home";
                </script>
                    ';
    }
}
?>

#3
[eluser]Rick Jolly[/eluser]
First, I wouldn't rely on javascript for cookies/redirects when you could use php. I'd make the home page the default page. Then I'd abstract the cookie/session stuff into a plugin or helper and call that in all controllers. The logic could be something like the following:

If the session lang is set then return.
Else, try to get the lang cookie.
If the lang cookie is set, then set the session lang from it and return.
Else, select a lang for the user then set the cookie and the session lang and return.

#4
[eluser]OwanH[/eluser]
Also remember that CodeIgniter has cookie helper functions that lets you set and retrieve cookies from in PHP.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.