Skip to content

Instantly share code, notes, and snippets.

@mikeyhill
Created February 29, 2016 03:48
Show Gist options
  • Save mikeyhill/fe3362025d4dded2b8a8 to your computer and use it in GitHub Desktop.
Save mikeyhill/fe3362025d4dded2b8a8 to your computer and use it in GitHub Desktop.
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L]
#
## rewrite non www -> www
#
server {
listen 80;
server_name domain.com;
rewrite ^(.*)$ $scheme://www.domain.com$1;
}
#####################################################################
#RewriteRule ^/gallerier/(.*) /gallerier.asd?id=$1 [R=303,L]
#
## single page rewrite with querystring
#
location /gallerier {
rewrite ^/gallerier/(.*) /gallerier.asd?id=$1 redirect;
}
#####################################################################
#
## RewriteRule ^/images/(.*) /images.asd?id=$1 [L]
#
location /images {
rewrite ^/images/(.*) /images.asd?id=$1 break;
}
#####################################################################
## RewriteCond %{REQUEST_FILENAME} ^/[^.]+$ [NC]
## RewriteCond %{REQUEST_FILENAME} !^/[^.]+\.asd$ [NC]
## RewriteRule ^/(.*) /gallerier.asd?urlusername=$1&%1 [L]
if ($request_filename ~ ^/[^.]+$) {
rewrite ^/(.*) /gallerier.asd?urlusername=$1&%1 break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment