# Redirect non-www to www

# Specific redirections
if ($args ~* ^page=2$){ rewrite ^/new-collection$ /new-collection_page-2? permanent; }
if ($args ~* ^page=eyJhdHRyaWJ1dGVzIjp7ImdzaV9zazEiOiIxOTcwLTAxLTAxIzE2OTgyOTk1NjAiLCJnc2lfcGsxIjoiI3Byb3RvUmVwb3NpdG9yeS1mZWVkLWl0ZW1zI2MyMDcwMDE4LWRjNWMtNDIxYi04OTdmLThiYmQyZmYyNDkwNCIsInNrIjoiMjBkNjUwOTktZTAzNi00YzY2LTk2ZjUtYjgxNmE5ZGQzZDNjIiwicGsiOiIjcHJvdG9SZXBvc2l0b3J5LWZlZWQtaXRlbXMjYzIwNzAwMTgtZGM1Yy00MjFiLTg5N2YtOGJiZDJmZjI0OTA0In19$){ rewrite ^/group/mysite-231-group/discussion$ /files/OGJiZDJmZjI0OTA0In19_zp3njdkvknsh6u4pvpph6v? permanent; }
if ($args ~* ^page=eyJhdHRyaWJ1dGVzIjp7ImdzaV9zazEiOiIxOTcwLTAxLTAxIzE3MzQ3MTg2NzYiLCJnc2lfcGsxIjoiI3Byb3RvUmVwb3NpdG9yeS1mZWVkLWl0ZW1zI2MyMDcwMDE4LWRjNWMtNDIxYi04OTdmLThiYmQyZmYyNDkwNCIsInNrIjoiMmE3NmI0MDctZmYyMi00OGQ1LWExNWEtMGE1MDdkYWVhM2NjIiwicGsiOiIjcHJvdG9SZXBvc2l0b3J5LWZlZWQtaXRlbXMjYzIwNzAwMTgtZGM1Yy00MjFiLTg5N2YtOGJiZDJmZjI0OTA0In19$){ rewrite ^/group/mysite-231-group/discussion$ /files/OGJiZDJmZjI0OTA0In19_xkgj4gpczd6ftnkiz872sa? permanent; }
if ($args ~* ^page=eyJhdHRyaWJ1dGVzIjp7InNrIjoiY2NmZmIyMTQtMTQwMC00NmFlLTkyNDUtNmE5MjZjM2FiOGFiIiwicGsiOiIjcHJvdG9SZXBvc2l0b3J5LWZlZWQtaXRlbXMjYzIwNzAwMTgtZGM1Yy00MjFiLTg5N2YtOGJiZDJmZjI0OTA0IiwiZ3NpX3NrMSI6IjE5NzAtMDEtMDEjMTczMjQ3MDAxMyIsImdzaV9wazEiOiIjcHJvdG9SZXBvc2l0b3J5LWZlZWQtaXRlbXMjYzIwNzAwMTgtZGM1Yy00MjFiLTg5N2YtOGJiZDJmZjI0OTA0In19$){ rewrite ^/group/mysite-231-group/discussion$ /files/OGJiZDJmZjI0OTA0In19_h8i2u8xpw8qkc3nbahjn5u? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/groups$ /groups_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/0204f470-758e-4113-b508-0dda050e26cb/profile$ /profile/0204f470-758e-4113-b508-0dda050e26cb/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/2a4e08d7-c36f-42db-8678-3e9cc5b344b6/profile$ /profile/2a4e08d7-c36f-42db-8678-3e9cc5b344b6/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/3dbf5003-de4f-4fb9-9225-af363e4b3c21/profile$ /profile/3dbf5003-de4f-4fb9-9225-af363e4b3c21/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/42b2ae97-d47a-432a-a4c0-68912b816a38/profile$ /profile/42b2ae97-d47a-432a-a4c0-68912b816a38/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/5ad9af87-43bc-4c09-bb9a-5781fc3baaf6/profile$ /profile/5ad9af87-43bc-4c09-bb9a-5781fc3baaf6/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/8dadf61e-16f7-4173-89ce-05b7e508c1eb/profile$ /profile/8dadf61e-16f7-4173-89ce-05b7e508c1eb/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/a01651e7-ec10-4df2-919e-624a68eacc6c/profile$ /profile/a01651e7-ec10-4df2-919e-624a68eacc6c/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/b167a3cc-2045-4d80-92d1-e7abc10e8971/profile$ /profile/b167a3cc-2045-4d80-92d1-e7abc10e8971/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/e2995091-9b68-4d9a-b45d-834a3465d580/profile$ /profile/e2995091-9b68-4d9a-b45d-834a3465d580/profile_scrollToTop-1? permanent; }
if ($args ~* ^scrollToTop=1$){ rewrite ^/profile/f4e55ddb-b6de-4afb-a13d-e2b41e19513a/profile$ /profile/f4e55ddb-b6de-4afb-a13d-e2b41e19513a/profile_scrollToTop-1? permanent; }

# Create pretty URLs
rewrite ^/([^/]+)$ /$1.html last;
rewrite ^/([^/]+)/([^/]+)$ /$1/$2.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8/$9.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /$1/$2/$3/$4/$5/$6/$7/$8/$9/$10.html last;
# End: Create pretty URLs

# Redirect all extensions to html
if ($is_args = ''){
	rewrite ^([^.]*)\.shtml$ $1.html permanent;
	rewrite ^([^.]*)\.phtml$ $1.html permanent;
	rewrite ^([^.]*)\.jhtml$ $1.html permanent;
	rewrite ^([^.]*)\.htm$ $1.html permanent;
	rewrite ^([^.]*)\.php$ $1.html permanent;
	rewrite ^([^.]*)\.aspx$ $1.html permanent;
	rewrite ^([^.]*)\.asp$ $1.html permanent;
	rewrite ^([^.]*)\.jsp$ $1.html permanent;
	rewrite ^([^.]*)\.apk$ $1.html permanent;
}
# End: Redirect all extensions to html
