WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Automatic (and unwanted) Redirection of HTML Pages

[Resolved] Automatic (and unwanted) Redirection of HTML Pages

Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi

    @esmi

    Forum Moderator

    This has nothing to do with canonical urls but is due to the fact that, in order to use a custom permalink structure, WordPress has to rewrite all incoming page request urls. Try resetting your custom permalinks back to the default setting via Settings -> Permalinks and deleting your WordPress .htaccess file to see if this helps.

    Thanks for the response.

    I changed to the default permalink structure and deleted the .htaccess file. Just to be sure I cleared my cache and flushed my dns.

    Same result. The pages, unfortunately, still redirect.

    Thoughts?

    esmi

    @esmi

    Forum Moderator

    OK – reinstate the custom permalinks and the .htaccess file. Then try adding:

    RewriteCond %{REQUEST_URI} !/sample-page\.html
    RewriteCond %{REQUEST_URI} !/sample-page_Choices\.html

    immediately before RewriteRule . /index.php [L] in your .htaccess file.

    Sadly, still didn’t work.

    Here’s what my .htaccess file looks like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !/acura-tsx\.html
    RewriteCond %{REQUEST_URI} !/acura-tsx_Choices\.html
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
    ErrorDocument 404 /
    ErrorDocument 403 / 
    
    Options -Indexes
    
    <Files wp-config.php>
    deny from all
    </Files>
    esmi

    @esmi

    Forum Moderator

    My .htaccess-fu is really rubbish. I’m sure the answer is staring me in the face but the brain isn’t working and I need a break. Going to ask someone with far better .htaccess to drop in and have a look at this.

    I really appreciate the help.

    Whenever you have more strategies for attacking the problem, let me know. 🙂

    You can hold off on asking your friend or honing your .htaccess-fu skills.

    The issue was not being caused by WordPress, but, in fact, by the Google Adwords script I mentioned earlier. It seems to choose whether you’ll be directed to the ‘A’ page or the ‘B’ page and won’t let go of that choice.

    Let me apologize profusely for wasting your time and efforts here.

    I do really appreciate your help, though. A million points to you for the solutions you offered up.

    esmi

    @esmi

    Forum Moderator

    Glad to hear that you got it sorted. 🙂

    It seems to choose whether you’ll be directed to the ‘A’ page or the ‘B’ page and won’t let go of that choice.

    For reference, browsers *cache* redirections. I know, caught me by surprise too when I first encountered it.

    You may be able to prevent this by making the redirection mechanism use a 302 or 307 redirect instead of a 301. Alternately, you might be able to change it to have a header in the response of “Cache-Control: no-cache” to prevent browsers from caching the redirection.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Automatic (and unwanted) Redirection of HTML Pages’ is closed to new replies.
Skip to toolbar