htaccess rewrite or redirect

I need to redirect just this url: to this one:

This url: is actually a wordpress category so there will be sub-categories with posts in it. Those sub-categories and their posts I need to still go to the correct urls such as

When I use the regular redirect of:
redirect 301 /programs
the sub-category also redirects with programs-page in it leading to a 404.
LVL 14
Who is Participating?
Dr. KlahnPrincipal Software EngineerCommented:
This should do the job for standard HTTP.  If you allow HTTPS it may more complicated and you might need two rulesets.

RewriteCond %{REQUEST_URI} ^/$               [NC,OR]
RewriteCond %{REQUEST_URI} ^/$              [NC,OR]
RewriteCond %{REQUEST_URI} ^/$    [NC]
RewriteRule .* /             [L]

Open in new window

If your default page for unterminated URLs or URLs terminated in "/" is not "index.html", adjust the above as necessary.

NB:  The above uses mod_rewrite syntax for Apache 1 through Apache 2.2.  Apache 2.4 uses different syntax so this ruleset may not work on a 2.4 server.  In that case make the necessary adjustments.
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You're seeing a 404 because the link you provided is a 404...

imac> curl -s -I -L | egrep -ie ^http -e ^location
HTTP/1.1 301 Moved Permanently
HTTP/1.1 404 Not Found

Open in new window

First start with a working link.

Also, I'd strongly suggest you use 302s until your entire rewrite strategy is working, else you may get a 301 stuck in your browser cache, which will make debugging very difficult.

The way I work out redirection problems for clients, is using curl, to avoid all browser caching issues.
DzynitAuthor Commented:
I couldn't get the rewrite to work so I just went a different route using the programs category description to display the page content and added some conditionals so posts from the sub-categories won't display when on
DzynitAuthor Commented:
Thank you for trying.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.