Hi there, I need a solution to a ModRewrite problem I have. In its simplest form it will be a file extension rewrite. Example: I need to change the extensions of a great many files from PDF to XML. These files life in subdirectories under the following tree: http://www.mydomain.com/data/documents/12x456f/doc1.pdf There are hundreds of unique directories under /data/documents/ I want to avoid having a ModRewrite for every /data/documents/???????/ directory. I want the /???????/ part to be a variable that is passed on to the rewritten URL so that the file extension is re-written to be: http://www.mydomain.com/data/documents/12x456f/doc1.xml And so forth for every instance of: http://www.mydomain.com/data/documents/???????/doc1.xml Any help in accomplishing this will be much appreciated. Kind regards Mudder
Maybe something like this: RewriteEngine On RewriteBase / RewriteRule ^data/documents/([^/]+)/doc1.pdf$ /data/documents/$1/doc1.xml [L] Code (markup): or in the case your filename is also an variable then you should try something like this: RewriteEngine On RewriteBase / RewriteRule ^data/documents/([^/]+)/([^/]+).pdf$ /data/documents/$1/$2.xml [L] Code (markup):