WordPress Rewrite Redirect Failure

I’m helping a friend recover from the mess outsourcing a wordpress website caused him (mistake #1) and I have this weird error. The hosting he is using appears to be redirecting www.domain.com to domain.com (NFI why) automatically which works fine in every browser except IE (i know right!). So adding the first redirect fixed that, until I added the permalink redirect. Now when IE goes to an old wordpress link like http://www.domain.com/?p=520 the redirect fails.

Read More
RewriteEngine On
RewriteBase /

# Rewrite rule for wierd redirect issue
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?(.*)$ "http://doman.com/$1" [R=301,L]

# Rewrite Rule for Wordress Permalinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I tested this out with wget and it complains:

ERROR: Redirection (301) without location.

So it seems likely that IE is suffering from the same error (without the helpful error message). But I haven’t a clue how to fix it. I am hoping that he will switch hosting companies but we will see. In the meantime any ideas?

Related posts

Leave a Reply

2 comments

  1. I will answer why “www.domain.com” was “domain.com”,
    the 3rd party developer must have been under the deprecated www movement.

    Basically, it shouldn’t have affected any of the browsers. I do suggest resetting your cache and or flushing your dns.

    Try removing:

    # Rewrite rule for wierd redirect issue
    RewriteCond %{HTTP_HOST} ^www.domain.com$
    RewriteRule ^/?(.*)$ "http://doman.com/$1" [R=301,L]
    

    Reupload then see if it works properly. If not, delete your cache. Refresh to see if it works properbly. And if it still not, try flushing your DNS.

    If you using Windows, you can flush your DNS from the Command Prompt.

    These are the steps I take:

    1. Start
    2. Run
    3. Cmd
    4. ipconfig /flush-dns

    For any other O.S. I am unsure how to flush the DNS.

    I usually take these precautions when I switch hosts for the domain name but this may be related as it is domain related. Hope that helps.

    I also want to add that a regular WordPress .htaccess file looks like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    

    So if all else fail, just replace everything with the basic WordPress .htaccess code.

    Good Luck 🙂