I'm trying to use Apache mod_alias / mod_rewrite / scriptaliasmatch to solve the following problem:
I need requests for files in this format:
to be mapped to files that exist at this location:
The first two letters of the file name need to be added to the directory path of the file.
I need this to work for all requests to the images folder, so these URL's
Need to be mapped to the files:
What is the best way to accomplish this?
You can capture parts of the original string with (parentheses), then you can use those captured values in the replacement with $1, $2, etc. Here's an example that will probably work. I haven't tested it.
RedirectMatch 301 ^/images/(([^/])([^/])[^/]*)$ /images/$2/$3/$1
Thanks so much Jeff .. This worked perfectly once I removed the first forward slash!
This topic is now closed. New replies are no longer allowed.