How to rewrite mod from old folder to new folder

Hi,
I made a large change to one of the folders of my site. Changed www.example.com/places/ to www.example.com/united-states/ . How do I rewrite mod(apache) to 301 redirect everything from places to unied states for all files and urls in that folder?

Have you checked this out yet? https://httpd.apache.org/docs/2.4/rewrite/remapping.html

1 Like

That tells me everything except what I want to do. It doesn’t tell me how to redirect one directory to another. It tells me how to change specific URLS and what to do if I moved the resources to another server.

Maybe try this option from the recommended link:

Description:
A particular resource might exist in one of several places, and we want to look in those places for the resource when it is requested. Perhaps we’ve recently rearranged our directory structure, dividing content into several locations.

Solution:
The following ruleset searches in two directories to find the resource, and, if not finding it in either place, will attempt to just serve it out of the location requested.

I found the answer elsewhere:

RewriteRule ^places/(.*)$ /united-states/$1 [R=301,NC,L]

Does the trick

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.