从AMP网址重定向到真实网址

时间:2017-04-12 04:14:47

标签: wordpress .htaccess redirect mod-rewrite

我想将旧链接放大器链接转换为wordpress中的基本主题 通过.htaccess文件 我试过这段代码但是没有用

#Redirect old AMP URLs
RewriteRule (.*)/AMP$ $1 [NC,R=301,L]

#Redirect old AMP URLs
RewriteRule (.*)/amp/$ $1 [NC,R=301,L]

我想从

重定向

2 个答案:

答案 0 :(得分:0)

使用此

// connecting to spark driver
val conf = new SparkConf().setAppName("WordStats").setMaster("local")
val spark = new SparkContext(conf) //Creates a new SparkContext object

//Loads the specified file into an RDD
val lines = sparkContext.textFile(System.getProperty("user.dir") + "/" + "basketball_words_only.txt")

//Splits the file into individual words
val words = lines.flatMap(line => {

  val wordList = line.split(" ")

  for {i <- 0 until wordList.length - 1}

    yield (wordList(i), wordList(i + 1), 1)

})

答案 1 :(得分:0)

在WordPress中,要将所有AMP网址重定向到NON-AMP(Canonical)版本,您可以使用以下规则 -

# Redirect from AMP to non-AMP path
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteCond %{REQUEST_URI} !^/wp-content/(.*)$ 
RewriteRule ^ %1/ [R=301,L]

来源:https://www.gulshankumar.net/fix-404-on-amp/ 免责声明:我是作者。