Welcome Guest, Not a member yet? Register   Sign In
301 redirect www.mywebsite.com to www.mywebsite.com/defaultcontroller/
#1

[eluser]setgreen[/eluser]
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 :

Code:
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
#2

[eluser]Tominator[/eluser]
Why you need to use 301?
#3

[eluser]setgreen[/eluser]
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.
#4

[eluser]Tominator[/eluser]
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
http://parser.comper.sk/
It's the same as:
http://parser.comper.sk/home

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

So my question is: Why 301?
#5

[eluser]setgreen[/eluser]
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.




Theme © iAndrew 2016 - Forum software by © MyBB