Hide pdf extension in URL

1

I need to hide the pdf file extension that is opened in my web system. I did some research and I saw that I had to do the htacces, but I did not succeed. How can I do this?

    
asked by anonymous 21.09.2015 / 16:53

2 answers

0

You can do this by using your .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.pdf -f
RewriteRule ^(.*)$ $1.pdf
    
21.09.2015 / 17:05
4

I was able to do what I wanted. My URL was as follows: /gedphp/upload/id_do_registro/arquivo.pdf. So I used the following settings:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.pdf -f
RewriteRule ^upload/([0-9]+)/(.+)$ upload/$1/$2.pdf
    
22.09.2015 / 13:21