Skip to content

Instantly share code, notes, and snippets.

@markggn
Created June 8, 2018 08:59
Show Gist options
  • Save markggn/f13fc8baf24548d60f8926838d569807 to your computer and use it in GitHub Desktop.
Save markggn/f13fc8baf24548d60f8926838d569807 to your computer and use it in GitHub Desktop.
// Apache
// Redirect AMP to non-AMP
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
//Nginx
if ($uri ~ "(.+)/amp(.*)$"){
set $rule_0 1$rule_0;
set $bref_1 $1;
}
if ($rule_0 = "1"){
rewrite ^/ /$bref_1/ permanent;
}
rewrite ^(.*/)amp/$ $1 permanent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment