How can I canonize my site?


My site is pure code igniter but I`m having problems with canonization, since the home page can be accessed in several ways, for example:

But other more is:

And I want only one way to access the home page, and must be and I want all other urls must be redirected to this one.

Then I found this page with very good information (in spanish)

Url Canónicas

Then my actual .htaccess is that:

RewriteEngine on

addtype application/x-httpd-php .html .htm

Rewritecond %{REQUEST_FILENAME} !-f
RewriteRule \.php$ /error404.html

RewriteBase /

RewriteCond $1 !^(\/|index\.php|system|application|iservices|mod_css|s eo|links|mod_img|mod_galeria|mod_scripts|includes| blog|adm_img|adm_css|resize|views|templates|img|im gs|js|css|images|tester|ecotourism|\/ecotourism\/gardens\/|system\/plugins|robots\.txt|language|css\/)

RewriteRule ^(.*)$$1 [L]

#RewriteRule ^email$ "http\:\/\/mail\.google\.com\/a\/sitio\.com" [R=301,L]
And I add this lines to the end of the htaccess

Options +Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sitio\.com
RewriteRule ^(.*)$$1 [R=permanent,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$$1/ [L,R=301]

this fix the problem and all non www urls are being redirected to the www url, but now when i type: it is redirected to

and I won´t that.

Can you help me with that canonization issue?

What I need is the home page only being accesible by


screw the htaccess, use routes
$routes['.*'] = "banano";

$routes['default_controller'] = 'home';

Sorry I don`t understand your answer, I`m newie.

Do I have to add this lines in the .htaccess?

or what?



Then I can`t do it in the .htaccess?

I need code the application/config/routes.php archive?

and only add this line.

$routes['.*'] = "banano";

$routes['default_controller'] = 'home';


you *could* do it in htaccess but its sooooooooo much easier doing in the routes.php file.

[eluser]Johan André[/eluser]
Codeigniter is setup to make seo-urls.
You use .htaccess to remove index.php if it bothers you.
All other work (well almost) is done with uri routing.

Read the userguide and it will become clear to you.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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