• yankeerudy

    (@yankeerudy)


    I set up my MU install on a server IP address while redesigning and migrating an existing site. Once the redesign/migration was completed, I made the appropriate changes to server, DNS, and database to enable the new WordPress MU site.

    Here’s the problem… there are several entries in the Google search index that point at the original IP address pages (i.e., http://74.52.2.28/study/accounting/accounting-cycle/general-ledger-accounting/ ) that I’d like to point to the new appropriate page. (The domain should be college-cram.com) When you click on the ip address link, it goes instead to the home page of the MU install.

    Is there a way to force the IP address to translate to the domain on the fly, so I don’t lose these search result links?

Viewing 5 replies - 1 through 5 (of 5 total)
  • blirette

    (@blirette)

    PHP can do this. Just catch the URL, replace the IP with the DNS and make a header redirect with the appropriate code (something like 301… google it).

    That is if the new page using the same path after the IP… hope it’s the case for you! 😉

    Thread Starter yankeerudy

    (@yankeerudy)

    Thanks for the reply, Blirette.

    By “catch the URL” do you mean using htaccess? Because with the htaccess accompanying the WordPress install, by the time the browser gets to a php page the extra URL stuff has already been stripped out.

    blirette

    (@blirette)

    Check this out :

    http://php.net/manual/en/reserved.variables.server.php

    You’ll have to use something in here (maybe $_SERVER[‘REQUEST_URL’]) to get the URL. Check in it if you see your IP with something like :

    $pos = strpos($mystring, $findme);

    If it’s a go, redirect to the other URL :

    header("Location:www.some-other-dns.com/with-the-rest-of-the-url-requested"

    Get the idea?

    Thread Starter yankeerudy

    (@yankeerudy)

    I understand how that works. Unfortunately, in the order of operations the browser request first passes through .htaccess before getting to a PHP page, and .htaccess itself redirects (and reformats) the IP-URL to the home page of the blog.

    I guess what I’m trying to nail down is a .htaccess oriented solution.

    blirette

    (@blirette)

    If every IP requests links to the homepage of the MU install, you just have to put this PHP code on that page.

    … or via htaccess, but I personnaly don’t like to use that trick.

    Anyway, hope it works for you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘translating server IP address’ is closed to new replies.