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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:21:22+00:00 2026-06-15T02:21:22+00:00

Scenario I’m moderating a website that has moved to a WordPress based setup, but

  • 0

Scenario

I’m moderating a website that has moved to a WordPress based setup, but without access to all the administration tools in WordPress (it’s externally hosted/managed), but I do have access to the htaccess file. Now, there’s two things I need to do:

  1. Redirect the old pages to the new url structure.
  2. Redirect all www calls to non-www.

The challenge

I would however like to accomplish this with:

  1. Fewest possible redirects per call (preferably only 1).
  2. With limited rule duplication.
  3. Be somewhat readable (not just one inline Regex handling it all).
  4. All edited in the htaccess alone.

What is giving me a hard time, is keeping the redirects to a minimum when it is both an old url, and prefixed with www as well.

My next biggest problem is, that I would like to use a rewrite map, but it seems you have to load something externally, rather than defining a dictionary in the htaccess file which is what I would prefer.

Further details

  • I’m no expert at using the Rewrite Engine so I might be missing a simple solution here.
  • The old website was structured simply with /index.php?page=<pageName>.
  • The new website uses seo-friendly urls /a-new-url-example/.
  • Two examples could be:
    1. from mydomain.com/index.php?page=boots to mydomain.com/boots/
    2. from www.mydomain.com/index.php?page=shoes to mydomain.com/shiny-shoes/ (some kind of map is needed to handle shoes->shiny-shoes)
  • The current setup on my own computer does not allow me to test it locally (having a lot of conflicts with other projects), so currently I am testing the setup with http://htaccess.madewithlove.be/.
  • Current content of the htaccess file (on pastebin, as the code kept getting interpreted as something else here).
  • 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-06-15T02:21:23+00:00Added an answer on June 15, 2026 at 2:21 am

    I hope this doesn’t clash with your existing rules inside htaccess, as you have provided that.

    #exceptions first
    RewriteCond %{QUERY_STRING} ^page=shoes3$ [NC]
    RewriteRule ^index\.php$ /shiny-shoes/? [R=302]
    
    #urls that directly map to the new url scheme
    RewriteCond %{QUERY_STRING} ^page=(.*)$ [NC]
    RewriteRule ^index\.php$ /%1/? [R=302]
    
    #note the absence of the L flag in the above rules.
    # from apache docs: the [R] flag prepends http://thishost[:thisport] to the URI, but then passes this on to the next rule in the ruleset
    
    # no-www (make sure this is the last rule)
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^http://[^/]+/(.*)$ http://%1/$1 [R=302,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: I have a text file that has pipe (as in the | character)
Scenario: I have a TFS Build (TFS2008) that has several targets override: BuildNumberOverrideTarget, AfterGet,
Scenario: I have a ASP.NET 3.5 WebForms based website. It contains Foo.aspx , Bar.aspx
Scenario: Making an Android app using data from a website built with Wordpress. The
Scenario: I'm working on a solution that has many assemblies. The main assembly references
Scenario: There is a website with 700-900 concurrent unique visitors at any given time.
Scenario: Every page on the website will have a menu bar at the top
Scenario: An MVC3 app that uses constructor injection to provide services for a given
Scenario: A huge Patient class/entity with around 100 properties. But in the webpage I
Scenario: many to many relationships. table has 2 columns: UserID and UserChoiche I am

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.