Redirect Question - Help please

by Bon508
13 replies
  • WEB DESIGN
  • |
I'm trying to fix up a website that someone else created and (among other things) violated EzineArticles.com's TOS by changing articles he posted on the site.

The articles were uploaded to a specific articles directory.

Some of the articles are doing well in the search engines and bringing traffic to the site. But besides the TOS violations, the unauthorized editing (which includes stuffing location-specific keywords into them) makes them read kinda stupid.

So I want to remove all of those articles from the site -- but somehow still capture the visitors who click on their links that are turning up in the SERPs. (As I remove the articles, they'll get a HostGator 404 error.)

I'm not tech-savvy or anything, so I may be completely off base, but I thought a 301 redirect would work -- I would like to redirect from the article directory to the website's home page.

I thought I could do a redirect of all articles from the article directory to the index page... but I tried this and the result is that the file name remains the same except for the directory -- so this results in a 404 error.

Example:
Original URL: example.com/articles/this-is-an-article.html
Redirected URL: example.com/this-is-an-article.html

The article is not there, the URL does not exist, hence the 404 error.

So this is NOT the result I want.

I'm sure there's gotta be a simple way to set it up so that whenever anyone clicks on any of the article URLs, they are just taken to the home page.

(I realize this will annoy people looking for the article and being taken to the site's home page instead, but I feel it's the lesser of two evils.)

I hope I'm explaining my problem and desired solution clearly enough.

Is it possible to redirect all URLs for files within a directory, regardless of file name, to just the home page?

Thanks in advance for any advice and suggestions!

Bonnie
#question #redirect
  • Profile picture of the author CircularLogic
    Hi Bonnie:

    I've only had to do this once or twice in the past, so I imagine someone will chime in with better answers. In the meantime, a few options....

    Are you using Wordpress by chance? If so, this plugin might be of some assistance.

    If not, there are ways using the .htaccess file to force a redirect from 404'ed pages. I believe this article might put you a few steps closer.

    Jeremy
    {{ DiscussionBoard.errors[5085397].message }}
    • Profile picture of the author Bon508
      Hi Jeremy,

      Unfortunately, it's NOT a WordPress site. (I sure wish it was!)

      Thanks for your suggestion about using .htaccess but I've tried that. It does what it's supposed to do -- redirect away from the articles directory and to the main site URL -- but this doesn't help. The URL drops the directory but retains the file name, and since the file is not there, the 404 error occurs.

      Maybe I'm thinking about this the wrong way.

      Would it be easier/better to modify the 404 error message -- customize it and include a link to the Home page?

      Off to do more research... (but still appreciate any advice!)
      Signature
      {{ DiscussionBoard.errors[5088146].message }}
  • Profile picture of the author Istvan Horvath
    1. When you want to give an "example" URL - use just that: example.com
    That domain has been set aside for examples... all the rest (e.g. whatever) goes to real, living websites!

    2. I don't understand why .htaccess wouldn't work. Maybe you put in the wrong code?

    It should be redirecting from
    example.com/articles/article-xxx.html to example.com/
    Signature

    {{ DiscussionBoard.errors[5088260].message }}
    • Profile picture of the author Bon508
      Whoops. Thanks Istvan -- I've corrected my original post.

      The .htaccess DOES work, but it's not the right solution. I'm not moving the articles, I'm deleting them. The .htaccess redirects from example.com/articles/article-name.html to example.com/article-name.html -- it leaves the file names. Since the files aren't "there," it creates an error.

      Instead, I've just created a custom 404 file. It works... when someone clicks on an article link that's no longer valid, they go to the 404 page I created (versus the default HostGator one that used to show up).

      But for some reason, the website formatting isn't working properly. It looks perfect when I view it in "design" mode and when I do a "preview" while editing it -- but the live version isn't incorporating the website design.

      I am not an html person, so I simply copied the code of an existing page and edited the text (not any of the code)... so I don't understand what's gone wrong. *SIGH*

      Here's an example: error page

      Does that look okay to YOU? (If so, maybe it's my cache or something?)
      Signature
      {{ DiscussionBoard.errors[5088393].message }}
  • Profile picture of the author kashem
    Hi

    I can see some errors while checking your source code
    view-source:http://www.vividpaintingllc.com/powe...power-washing/

    observe that there is a <p> before <html> and a </p> after </html>

    Delete them then check again
    Signature
    Niche Masterly - Get Revenue Generating Keywords For Your Niche Site.
    {{ DiscussionBoard.errors[5088561].message }}
    • Profile picture of the author Bon508
      Hi Kashem,

      I just tried that and didn't see any change.

      Perhaps I didn't find the exact spot in the code that you mean. Can you please check the code again and let me know if I did it correctly?

      Thank you!
      Signature
      {{ DiscussionBoard.errors[5088620].message }}
  • Profile picture of the author kashem
    Maybe something wrong with your redirect . It is not getting your css file . Observe when I click this link http://www.vividpaintingllc.com/powe...css/layout.css , it says it is missing.

    To test , just remove the replace your old .htaccess file .
    Signature
    Niche Masterly - Get Revenue Generating Keywords For Your Niche Site.
    {{ DiscussionBoard.errors[5088669].message }}
  • Profile picture of the author Istvan Horvath
    The .htaccess redirects from example.com/articles/article-name.html to example.com/article-name.html
    That's why I said you must have wrong code in your htaccess file

    It should be redirecting to example.com - and nothing else.
    Signature

    {{ DiscussionBoard.errors[5088708].message }}
    • Profile picture of the author Bon508
      This is all that's in my .htaccess file:

      ErrorDocument 404 /error404.html

      I've deleted the redirect but I believe it used to be:
      "redirect 301 /articles/ http://www.example.com"

      (Without the quotes)

      Ugh. This stuff drives me bonkers!
      Signature
      {{ DiscussionBoard.errors[5089006].message }}
  • Profile picture of the author write-stuff
    This should do it:

    <script type="text/javascript">
    <!--
    window.location = "your-site-name-here-with-the-http-stuff"
    //-->
    </script>
    {{ DiscussionBoard.errors[5089052].message }}
  • Profile picture of the author Istvan Horvath
    I am not a htaccess expert but I'd try this:

    Code:
    RedirectMatch 301 ^/articles/$ http://example.com/
    Signature

    {{ DiscussionBoard.errors[5089297].message }}
    • Profile picture of the author Bon508
      This should do it:

      <script type="text/javascript">
      <!--
      window.location = "your-site-name-here-with-the-http-stuff"
      //-->
      </script>
      Thanks write-stuff, but can you tell me (exactly) where to put that? I am very "code-illiterate"
      Signature
      {{ DiscussionBoard.errors[5089541].message }}
      • Profile picture of the author Bon508
        Thank you everyone for your advice and suggestions.

        My special thanks to Kashem who generously volunteered to fix my problem for me! Yay!

        You Warriors rock!
        Signature
        {{ DiscussionBoard.errors[5101011].message }}

Trending Topics