How to remove "/" from the end of a server folder?

1

It's as follows: I have a contact folder on my site, which appears like this: www.mysite.com/contact/, and how do I get it to appear on www.mysite.com/contact? But it has to be just for the briefcase. Thank you.

    
asked by anonymous 04.12.2014 / 22:20

1 answer

1
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    DirectorySlash off
    RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
</IfModule>

Remembering that you will need to have the mod_rewrite module enabled in Apache.

Important note:

It is not a good idea to link to a website directory without the last / .

  • Why is it semantically incorrect to suggest that the link should be a file with no extension instead of a directory:
    www.meusite.com/contato/: directory
    www.mysite.com/contact: file

  • A redirection takes place from www.mysite.com/contact to www.mysite.com/contact /b>, when the server realizes that it is the "contact" directory.

    >
  • Error 404 may occur on the server.

More details on Linking Issues: Why a Trailing Slash in the URL Does Matter .

    
05.12.2014 / 22:04