Forum Discussion

aschi's avatar
aschi
Icon for Nimbostratus rankNimbostratus
Dec 06, 2013

iRule, Redirect "SEARCH ENGINE FRIENDLY"

Hi We have already Redirects in place which all work as expected. Our Marketing told us now that one Redirect isn't "SEARCH ENGINE FRIENDLY"

 

They checked it on the following Website: http://www.webconfs.com/redirect-check.php

 

the Redirect itself ist working. It seems that the Problem exist if the Domain afterwards is still the same. Or is the Problem because we just Change the host and Keep the uri? How can we solve this Problem? any Ideas?

 

NOT Working: when HTTP_REQUEST { if { [HTTP::host] contains "www.domain1.ch" } { HTTP::redirect http://www.domain1.ch[HTTP::uri] } }

 

The error message we get is: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) Either http://domain.com is NOT REDIRECTING to any URL or the redirect is NOT SEARCH ENGINE FRIENDLY

 

Working: when HTTP_REQUEST { if { [HTTP::host] contains "www.domain1.ch" } { HTTP::redirect http://www.domain2.com/de/solutions[HTTP::uri] } }

 

The message we get here is: Found redirect to http://www.domain1/de/solutions/. The Redirect is Search Engine Friendly

 

5 Replies

  • With this irule you're going to redirect requests everytime.

     

    It's going to make a redirect loop because your redirect host also contains "www.domain1.ch".

     

    Have you got something else which can be use as condition ?

     

  • aschi's avatar
    aschi
    Icon for Nimbostratus rankNimbostratus

    Sorry, i made a copy/pase error because I changed the original hostname. It's redirectiong from domain1.ch to www.domain1.ch when HTTP_REQUEST { if { [HTTP::host] contains "domain1.ch" } { HTTP::redirect http://www.domain1.ch[HTTP::uri] } }

     

    I also tried another Rule which also works great where no Hostname is needed: when HTTP_REQUEST {

     

    if { !([string tolower [HTTP::host]] starts_with "www.") } {

     

    HTTP::redirect http://www.[HTTP::host][HTTP::uri]"

     

    }

     

    }

     

    But the I still get the message: Not search engine friendly.

     

  • The problem is the same.

     

    Try to replace contains by equals it should work.

     

  • aschi's avatar
    aschi
    Icon for Nimbostratus rankNimbostratus

    Hi Thank you for answer but it didn't work. I get the same message back :-( Other ideas are appreciated. Regards, roger

     

  • Hi,

    I read a second time your last modification on your iRule and it appears to me that you've change something in it.

    Can you try this iRule :

    when HTTP_REQUEST { 
        if { [HTTP::host] equals "domain1.ch" } { 
            HTTP::redirect http://www.domain1.ch[HTTP::uri] 
        } 
    }