WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] I cant redierct a 404 error page (10 posts)

  1. sgd56
    Member
    Posted 1 year ago #

    I have a website running and had the theme changed and our website updated recently. When it was done one of our main pages was misspelt, after a month or two I realized this and changed the URL spelling. This has lead to a 404 error every time you search the url. the problem is I am getting good traffic to this page.

    http://www.bodycleanse4life.com/buy-isageni/.../isagenix-9-day-cleanse

    I have searched the above link in my dashboard to correct the url but can't find it.

    I have tried using a permanent redirect 301, this is not working as the incorrectly spelt page seems to be lost. When I search I still get the 404 error.

    Any ideas?

  2. egado
    Member
    Posted 1 year ago #

    Maybe I'am too tired... or its because I'am not a native english speaker, but I don't understand your problem in detail... :(

  3. sgd56
    Member
    Posted 1 year ago #

    Thanks for responding.

    When people click on this url in Google

    http://www.bodycleanse4life.com/buy-isageni/.../isagenix-9-day-cleanse

    they get a 404 error on the page. I have tried to use a 301 redirect to the correct url, but it is not working, the page still shows as a 404 error, instead of redirecting to the page we want.

    Thanks

  4. egado
    Member
    Posted 1 year ago #

    Did you try this in your .htaccess or how do you realise the redirect?

    RedirectPermanent /buy-isageni/product-paks/isagenix-9-day-cleanse http://www.bodycleanse4life.com/CORRECT-URL
  5. sgd56
    Member
    Posted 1 year ago #

    We have gone through the .htaccess and can see the rewrite as you have shown it. But, its is not redirecting.

  6. egado
    Member
    Posted 1 year ago #

    strange... works fine in my tests...

    1. Where is your .htaccess located?
    2. You can try this in your .htaccess – place it before the other rules... right after RewriteEngine On

    RewriteRule ^buy-isageni/product-paks/isagenix-9-day-cleanse$ http://www.bodycleanse4life.com/fast-track-program [R=301,L]
  7. sgd56
    Member
    Posted 1 year ago #

    my .htaccess is located in public-html file

    I will show you what I am seeing. We have 2 redirects the 1st one is working but the other not

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    RewriteCond %{HTTP_HOST} ^bodycleanse4life\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bodycleanse4life\.com$
    RewriteRule ^/?$ "http\:\/\/www\.bodycleanse4life\.com\/isagenix\-cleanse" [R=302,L]
    
    RewriteCond %{HTTP_HOST} ^bodycleanse4life\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bodycleanse4life\.com$
    RewriteRule ^buy\-isageni\/product\-paks\/isagenix\-9\-day\-cleanse$ "http\:\/\/www\.bodycleanse4life\.com\/isagenix\-9\-day\-cleanse" [R=301,L]
  8. You mean your .htaccess is in the public_html FOLDER, right?

    it's a file on it's own.

    What's the REAL bad URL? You keep giving us http://www.bodycleanse4life.com/buy-isageni/.../isagenix-9-day-cleanse (see the ...?) which tells us the URL format is buy-isagenu/(something)/isagenix-9-day-cleanse

    Rule 1 - ALWAYS put your WP code on the bottom.

    Rule 2 - Keep your redirects as simple as you can :)

    This:

    RewriteCond %{HTTP_HOST} ^bodycleanse4life\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bodycleanse4life\.com$
    RewriteRule ^/?$ "http\:\/\/www\.bodycleanse4life\.com\/isagenix\-cleanse" [R=302,L]

    Says 'Any time someone comes to my domains, and goes to ANY page, send them to http://www.bodycleanse4life.com/isagenix-cleanse - Is that what you want? It would redirect EVERY page. You probably don't want that.

    This:

    RewriteCond %{HTTP_HOST} ^bodycleanse4life\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bodycleanse4life\.com$
    RewriteRule ^buy\-isageni\/product\-paks\/isagenix\-9\-day\-cleanse$ "http\:\/\/www\.bodycleanse4life\.com\/isagenix\-9\-day\-cleanse" [R=301,L]

    Says 'Anyone who comes to http://www.bodycleanse4life.com/buy-isageni/isagenix-9-day-cleanse goes to http://www.bodycleanse4life.com/isagenix-9-day-cleanse instead' - Again, I don't think that's what you wanted.

    If you want http://www.bodycleanse4life.com/buy-isageni/isagenix-9-day-cleanse/ to go to http://www.bodycleanse4life.com/fast-track-program/ then do this:

    RewriteRule ^buy-isageni/isagenix-9-day-cleanse(.*)$ http://www.bodycleanse4life.com/fast-track-program [R=301,L]

    `

  9. sgd56
    Member
    Posted 1 year ago #

    Hi I feel we are starting to get to the issue, I apologize if my lack of knowledge has made it hard to understand.

    This

    RewriteCond %{HTTP_HOST} ^bodycleanse4life\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bodycleanse4life\.com$
    RewriteRule ^buy\-isageni\/product\-paks\/isagenix\-9\-day\-cleanse$ "http\:\/\/www\.bodycleanse4life\.com\/isagenix\-9\-day\-cleanse" [R=301,L]

    Is exactly what I want but it is not working. I don't know what else I need to do?

  10. What is the BAD url?

    Where do you want it to go?

    Don't try and write the code :) It's clearly not working, and what you're showing us is inefficient and redundant.

Topic Closed

This topic has been closed to new replies.

About this Topic