Hide pdf extension in URL

Asked

Viewed 185 times

1

I need to hide the extension of the pdf file that opens on my web system. I did some research and saw that to do by htacces, but did not succeed. How can I do this?

  • 1

    See http://forum.imasters.com.br/topic/504037-ocultar-a-extensao-php-da-urlhtaccess/. I think it might help you

  • Thanks for the tip

  • I’m glad he helped you.

2 answers

4

I got what I wanted. My URL was as follows: /gedphp/upload/id_do_register/file.pdf. Therefore I used the following settings:

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

0


You can do this by using your file .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.pdf -f
RewriteRule ^(.*)$ $1.pdf
  • I took the test and it didn’t work... I guess I have to go all the way through the URL and at the end put the extension. My URL is this one: /gedphp/upload/id_do_register/file.pdf.

  • Thanks for the help again.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.