Comments on The Useful Uses Of Mod Rewrite
In this tutorial, I'm going to be teaching what mod rewrite is and few examples of its uses. Mod rewrite is a powerful tool and one of the simplest ways to make your website more SEO friendly.
2 Comment(s)
Comments
What happens when there is no trailing slash?
Basically,
The web addresses of:
http://myserver/mydir -- and --
http://myserver/mydir/
are two separate 'contexts' for the web server which require the server to analize the security access requirements of mydir twice if the trailing '/' is omitted.
The way I understand it is, when you request //myserver/mydir, the server checks the security context of pages in your 'document root' (or whatever the parent directory is) to see if you have access to a page called 'mydir'. When it discovers that 'mydir' is a directory, the server appends the trailing '/' and then it has to repeat the entire process again for the directory 'mydir/' before providing access to the index.html or other page in the 'mydir' directory.
Conversely, if you had requested mydir/ originally, there is one the single security context check for the directory mydir before access to the pages are provided.
Simply put if you just put mydir, then the server checks the parent directory for access permissions, finds that mydir is really the directory mydir/, appends the /, and then has to do the checks all over again for mydir/.
So do your server a favor and always append the trailing / to directory names ;-)