Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6125293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:13:51+00:00 2026-05-23T16:13:51+00:00

I have multiple web sites for my clients and each client has a directory

  • 0

I have multiple web sites for my clients and each client has a directory labelled articles. I just inherited this system and I until I can fix the issue I found, I am looking for stopgap solution, one that will eliminate the 404 errors after a file has been deleted.

All these directories have static pages for the articles, as well as an index page that lists all the articles.

Based on the logs it generates many errors from over the years. I can just imagine it is causing havoc the search engines as well.
With little knowledge of mod rewrite that I have, I managed to put this together which I plan to put into place within the Apache configuration. Before I do, is this good solution or is there something else I should do.

<Directory "/home/www/public_html/clients">
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/articles/index.html [R=301,L]
</Directory>

RewriteCond %{REQUEST_FILENAME} !-f is looking to see if the file exists and if does display it while ignoring the rest of rewrite.

RewriteCond %{REQUEST_FILENAME} !-d is looking to see if the directory exists and if does display it while ignoring the rest of rewrite.

RewriteCond %{HTTP_HOST} ^(.+)$ [NC] grabs the domain to passes it to the last rewrite as 301 redirect.

I have it working locally and like a few opinions before making live.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:13:51+00:00Added an answer on May 23, 2026 at 4:13 pm
    1. No need for RewriteCond %{HTTP_HOST} ^(.+)$ [NC] line — just replace your %1 in RewriteRule by %{HTTP_HOST}

    2. From rewriting point of view the solution is OK

    3. From SEO point of view — not so sure — better have it 404 or 410 instead (since the article is no longer there). I think it will be better to display custom page to the customer while sending 404 or 410 to the browser:

      • Browser/Search Engine will see error code
      • User will see explanation instead while offered to see related to the requested URL pages/short index.
    4. From User point of view — not good: I would like to know that URL/article is no longer available straight away (see #3) and browse your site around if I find it useful, rather than seeing some irrelevant (at first) index page and telling myself — I do not remember clicking this link, and go back to search engine/referral and click again. If I will see the same index page again — I understand (most likely) that something wrong with that page and just turn away (unless I really interested in that page’s content).


    UPDATE:

    I would do it this way:

    Options +FollowSymlinks
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/articles/ [NC]
    RewriteRule .* /articles/notfound.php?url=%{REQUEST_URI} [L]
    
    1. Redirect non-existing URLs to notfound.php (or whatever else name it may have) ONLY if requested URL has anything to do with articles (URL starts with /articles/)

    2. On that page (has to be dynamic (PHP or similar) and not static HTML) respond with 410 Gone Error Code (for browser/spider) and display a page explaining that this URL is no longer here but you can look at these links (and some useful links — could be mini-index/recent articles etc) — this is for user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web form that has multiple ListBoxes, TextBoxes, DropDowns. If I put
I have multiple branches of a project checked out, each under their own directory
I have about 50 web-sites, load-balanced across 5 web-servers. They all use Enterprise Library
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have multiple projects in a couple of different workspaces. However, it seems like
You have multiple network adapters. Bind a UDP socket to an local port, without
We have multiple MFC apps, which use CMutex( false, blah ), where blah allows
I have multiple classes that all derive from a base class, now some of
I have multiple layers in an application and i find myself having to bubble
I have multiple threads (C# application running on IIS) running that all need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.