2021年1月19日星期二

How to remove the need of txt extension with a final optional trailing slash in url using htaccess

How to remove the need of txt extension of txt files and add a final optional trailing slash in url using htaccess regex in php

my code is

   #turn on url rewriting   RewriteEngine on    #remove the need for .txt extention  RewriteCond %{REQUEST_FILENAME} !-d  RewriteCond %{REQUEST_FILENAME}\.txt -f  RewriteRule ^(.*)(/?)$ $1.txt  

But it throws 500 Server error.What's wrong with the code?

https://stackoverflow.com/questions/65802944/how-to-remove-the-need-of-txt-extension-with-a-final-optional-trailing-slash-in January 20, 2021 at 12:06PM

没有评论:

发表评论