WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Automatic (and unwanted) Redirection of HTML Pages (10 posts)

  1. emailmike1994
    Member
    Posted 2 years ago #

    I've created HTML landing pages on a domain where WordPress is installed.

    These pages have the URLs like the following:
    http://www.domain.com/sample-page.html
    http://www.domain.com/sample-page_Choices.html

    If I attempt to navigate to the first page, most machines and browsers will redirect me to the second page. On some machines, clearing the cache will allow me to visit the first page. But if I then visit the second page and try to go back to the first, the redirecting starts again.

    I know that WordPress will try to 'fix' incorrect, incomplete, improperly formatted, or unofficial versions of URLs to canonical URLs. I wasn't sure if that what was happening here. I tried the solution to that problem (seen here: http://www.mydigitallife.info/how-to-disable-wordpress-canonical-url-or-permalink-auto-redirect/) to no avail.

    These pages are already involved in a Google Adwords A/B Experiment, so I would really prefer not to change the existing URLs.

    Any ideas what's happening here?

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  3. emailmike1994
    Member
    Posted 2 years ago #

    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?

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  5. emailmike1994
    Member
    Posted 2 years ago #

    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>
  6. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  7. emailmike1994
    Member
    Posted 2 years ago #

    I really appreciate the help.

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

  8. emailmike1994
    Member
    Posted 2 years ago #

    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.

  9. esmi
    Forum Moderator
    Posted 2 years ago #

    Glad to hear that you got it sorted. :-)

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic