301 redirect www.mywebsite.com to www.mywebsite.com/defaultcontroller/

Hi all,

I've been using Code Igniter for one of my website for some time now but something has been bothering me lately.

I would like to 301 redirect http://www.mywebsite/mydefaultcontroller to http://www.mywebsite.com/

Is there a way to do that using mod_rewite in the .htaccess file without messing things up (maybe I should look into the DNS stuff to solve this problem?)?
My .htaccess file contains the following for now :

RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

The above rewriting rule is the usual way to get rid of the 'index.php' part.

Could someone enlighten me about that? Smile

Why you need to use 301?

Well the company I work for has just hired a guy who's a referencement specialist...

They want me to do that and I can't really discuss it with them.

I see but why redirect by 301?

Because when you time your site it automatically load your default controller. See on my site:
When you type
It's the same as:

Everything what you need is delete index.php from your config.php ($config['index_page'] = ""Wink.

So my question is: Why 301?

They're telling me that the automatic redirection that Code Igniter do, using the default controller, from http://www.mywebsite.com/ to http://www.mywebsite.com/defaultcontroller/ isn't a 301 redirection but a 302.

And for some reason, they want Google to know that this redirection is a permanent one, so they need a 301.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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