Welcome Guest, Not a member yet? Register   Sign In
Redirect 301 Problem : Trying to redirect absolute urls to new CI site.
#1

[eluser]opel[/eluser]
Our SEO guy has given me about 30 absolute URLs that they say need to be pointed to pages in our new CI enabled site.

I tried adding them to the .htaccess file as usual but they don't seem to be working with CI routing functionality.

Can anyone help as our SEO guy is freaking out about google rankings...

This is what I have :
Code:
redirect 301 http://www.work-interactive.com/hosted/dadi/gallery/?next=31 http://www.work-interactive.com/sectors/


RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|uploads|public_images|layoutimages|tiny_mce|js|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php/$1 [L]
AddHandler php5-script .php

ErrorDocument 404 /error/page

I am hoping the 301 kicks in prior to the CI doing its routing. I have an alteration on my router that redirects to a catch all message which works so when I run tests still. From that I know that CI is still working but not my 301 redirects ?
#2

[eluser]garymardell[/eluser]
From what i can tell you should not have the http:///wwww.<domain>.com part in the first section of the redirect rule.

<code>
redirect 301 /hosted/dadi/gallery/?next=31 http://www.work-interactive.com/sectors/
</code>
#3

[eluser]Gordaen[/eluser]
I believe you'll have to do a rewrite rather than a redirect since there is a query string.
#4

[eluser]Colin Williams[/eluser]
Code:
RewriteEngine on

# SEO Redirects
RewriteRule /hosted/dadi/gallery/?next=31 http://www.work-interactive.com/sectors/ [R=301]
RewriteRule /hosted/dadi/gallery/?next=44 http://www.work-interactive.com/about/ [R=301]
# etc..

# CI front controller rewrite
RewriteCond $1 !^(index\.php|css|images|uploads|public_images|layoutimages|tiny_mce|js|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php/$1 [L]

AddHandler php5-script .php

ErrorDocument 404 /error/page
#5

[eluser]opel[/eluser]
Thanks guys I'll try it
#6

[eluser]opel[/eluser]
I tried the rewrite rule above but it didn't work it just kept kicking in with my default error page.

I have this in my routes :

Code:
/** project specific **/

$route['admin'] = "admin/login";
$route['casestudies'] = "casestudy/index";
$route['casestudies/:num'] = "casestudy/index/$1";
$route['casestudy/:any'] = "casestudy/detail/$1";

//services
$route['services'] = "service/index";
$route['services/:any'] = "service/detail/$1";
//sectors
$route['sectors'] = "sector/index";
$route['sector/:any'] = "sector/detail/$1";

$route['page/:any'] = "page/index/$1"; // gets pages

//301
$route['webpages/:any'] = "service/index";
$route['hosted/:any'] = "service/index";

And added a MY_Router.php file with the following code.

Code:
///lines above are standard router, below is custom bit

            return $segments;
        }

        // Can't find the requested controller...
        //show_404($segments[0]);
        $this->set_directory('');
        $this->set_class('error');
        $this->set_method('index');
        return array();
    }

Am I write in thinking that the htaccess should take effect prior to any of the CI stuff being actioned ?
#7

[eluser]opel[/eluser]
Finally got it working with

Redirect 301 /webpages/joinus.htm http://www.work-interactive.com/page/abo...nteractive

Cheers
#8

[eluser]Thorpe Obazee[/eluser]
Isn't that what Colin and garymardell posted already?




Theme © iAndrew 2016 - Forum software by © MyBB