Hello,
I'm trying to get this mod rewrite working, but so far wasn't successful.
The thing is I have a folder called "viri" with a large number of files inside. To reorganize everything I am creating subdirectories a-z 0-9 and moving all files in the appropriate folder according to their first letter.
For example I am moving all files that start with "a" to /viri/a/ , all files that start with "b" to /viri/b/ etc. So
will become
Now what I'm trying to do is to redirect people visiting the old URLs to the new ones. This is the closest I think I got, but doesn't work:
Or
I have the R=301 as I want this to be a permanent redirect.
Thanks in advance for any ideas or suggestions.
I'm trying to get this mod rewrite working, but so far wasn't successful.
The thing is I have a folder called "viri" with a large number of files inside. To reorganize everything I am creating subdirectories a-z 0-9 and moving all files in the appropriate folder according to their first letter.
For example I am moving all files that start with "a" to /viri/a/ , all files that start with "b" to /viri/b/ etc. So
will become
Now what I'm trying to do is to redirect people visiting the old URLs to the new ones. This is the closest I think I got, but doesn't work:
Code:
RewriteEngine on
RewriteRule ^\/(\w)(.*)$ /$1/$1$2 [R=301,L]
Or
Code:
RewriteEngine on
RewriteRule ^\/viri\/(\w)(.*)$ /viri/$1/$1$2 [R=301,L]
I have the R=301 as I want this to be a permanent redirect.
Thanks in advance for any ideas or suggestions.