我需要RedirectMatch Regex指令的帮助。
我需要将以下网址重定向,如下所示:
exports.stuff = "things";
let writeThisArrow = () => {
console.log(this);
};
writeThisArrow.call();
// {stuff: "things"}
exports.otherStuff = "other things";
writeThisArrow.call();
// {stuff: "things", otherStuff: "other things"}
我想要的结果是重定向到指定的产品标题,除非找到了单词页面:
http://example.com/category/category-title/some-product-title-here
重定向到
http://example.com/product/category-title/some-product-title-here
以下内容不匹配: http://example.com/category/category-title/page/23
编辑:
我有一个带有以下规则的重定向循环:
RedirectMatch 301 ^/category/category-title/(.+)(!?/page/)$ http://example.com/product/category-title/$1
感谢您的帮助!
答案 0 :(得分:1)
您的否定前瞻语法不正确,也被错误地放置。
试试这个:
RedirectMatch 301 ^/categorie/boulangerie-et-patisserie/(?!page/)(.+)$ /produit/boulangerie-et-patisserie/$1
RedirectMatch 301 ^/produit/boulangerie-et-patisserie/page/(.*)$ /categorie/boulangerie-et-patisserie/page/$1
正确的否定前瞻语法是(?!page/)
。
答案 1 :(得分:0)
在
Scanner scanner = new Scanner(filePath);
/*
* While we have data keep reading
* when out of data the simulation is complete.
*/
while (scanner.hasNext())
{
/*
* Get the data to simulate requests
* and feed it to the algorithm being evaluated.
*/
if (scanner.hasNextInt())
{
int temp = scanner.nextInt();
//System.out.println( this.tClientName+" "+temp);
/*
* Add the temp value from incoming stream.
*
* todo:: UNLESS its NOT found on the client as a miss
*/
tClientCache.getCache().add(temp);
}
else
{
scanner.next();
}
}//END Of while (scanner.hasNext())
/*
* Close the scanner
*/
scanner.close();
包括规则:
http://example.com/category/category-title/.htaccess
这翻译为:
仅 按照下一个RewriteCond %{REQUEST_URI} !^page/
RewriteRule ^(.+)$ http://example.com/product/category-title/$1 [R=301]
,如果请求的URI 不以RewriteRule
开头。