Created
June 8, 2018 08:59
-
-
Save markggn/f13fc8baf24548d60f8926838d569807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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