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 7409685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:07:14+00:00 2026-05-29T06:07:14+00:00

I just redeveloped an existing site from the ground up. The old site used

  • 0

I just redeveloped an existing site from the ground up. The old site used pure HTML while the new site will draw content from a database. Now I need to redirect the old pages to the new URL structure, but I’m a bit confused about how to write the .htaccess rules for a file-to-file redirect.

In all the examples I’ve found, the first part of the rule looks like an absolute directory path from the root, but they only contain the part of the URL that immediately follows the domain name.

For instance, I want to redirect

https://garrettcounty.us/archives/12262011news.html

to

https://garrettcounty.us/news/20111226/house-fire-on-christmas-day

From the examples I’ve seen (both on StackOverflow and abroad), I guess the rule would be

redirect 301 /archives/12262011news.html https://garrettcounty.us/news/20111226/house-fire-on-christmas-day

but the actual path to the original file on the server is

/home/username/public_html/archives/12262011news.html

Should I use the directory path or the path from the domain?

I would love to be able to use a rewrite rule. Unfortunately, the original developer didn’t use a consistent file naming scheme so I’m faced with things like

12262011news.html
Jan-19-2012-Headlines.html
State-Of-The-Union-25jan2012.html

In the new model, I’m directing everything through index.php with

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

so if anyone knows of an easier way to map all the old pages to the new URLs, I’d love to hear it. As it stands, it looks like I have to redirect 70+ pages one-by-one.

  • 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-29T06:07:15+00:00Added an answer on May 29, 2026 at 6:07 am

    Well you old URL doesn’t have news title so obviously mod_rewrite cannot create it. However to redirect

    https://garrettcounty.us/archives/12262011news.html

    to

    https://garrettcounty.us/news/20111226/

    you can use code like this in your .htaccess:

    Options +FollowSymLinks -MultiViews
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTPS} =on
    RewriteRule ^archives/(\d+)([^.]*)\.html$ https://garrettcounty.us/$2/$1/ [R=301,L,NC]
    

    Path used in Redirect directives: For mod_alias or mod_rewrite you must use path relative to DOCUMENT_ROOT not the full path on filesystem.

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

Sidebar

Related Questions

Just a question that came up from time to time at my old job
Just download latest Android SDK version from Android developers site, run ./android tool (i
just wanted to ask where I define initial class properties? From other languages I
Just see this: SELECT clientid,clientname,startdate,enddate,age FROM clients WHERE clientid IN (1,2,3,4,5) AND CASE WHEN
Just got a new Windows laptop, installing emacs23 on it. My previous computers have
Just create new project and checked Automatic Reference Counting and downloaded another project. when
Just ran across a for parameter in an HTML label tag: <label for=required-firstname> First
Just found out that this site uses tables for layouts. Does anyone find this
I have just redeveloped some vbscript in to c#.net and i have it working
Just started converting to MVC from classic ASP and wondering about best practice for

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.