Skip to content

Instantly share code, notes, and snippets.

@nomaster
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nomaster/56abb5286f87997cb484 to your computer and use it in GitHub Desktop.
Save nomaster/56abb5286f87997cb484 to your computer and use it in GitHub Desktop.
Normalise your URLs!
Bad
/opt/db/functions.php&session=5698136136
/forum.php?user=21515&group=134&mode=table
Good
/blog/2014/05/big-news
/articles/UGF1056-digital-camera
/users/alice/photos/fF96UXd
Assets?
<script src="/js/all.js"></script>
<link rel="stylesheet" src="//cdn.example.com/styles-1415.min.css"/> // look ma: no protocol!
<img src="/photos/fF96UXd.jpg" type="image/jpeg"/>
Router functionality
### Nginx configuration
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment