pparker Posted September 24, 2007 Share Posted September 24, 2007 Greetings, I would like to drop the .txt extension from all requests to text files in a certain directory. For your information, I am running Red Hat Enterprise Linux 4.0 with Apache 2.0.52. So this request: http://localhost/data/example.txt would be changed to: http://localhost/data/example The reason I am requesting your help is because this is basically the opposite of what most people try to do with mod rewrite. I have the code below that adds a file extension of .txt. I imagine that the code to remove an extension would be similar. RewriteEngine On RewriteCond %{REQUEST_fileNAME} !-d RewriteCond %{request_URI} !(\.[^./]+)$ RewriteRule (.*) /$1.txt [L] Does anyone know what the code would look like to remove a .txt extension? Any help is greatly appreciated. Thanks, Peter Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.