我想重定向,如http://example.com/sites-related-to-australia-0.html
。
在这个“澳大利亚”和“0”是参数。我如何使用htaccess来做到这一点?我使用的是PHP。使用htaccess重定向特定页面
任何帮助非常感谢,谢谢!
我想重定向,如http://example.com/sites-related-to-australia-0.html
。
在这个“澳大利亚”和“0”是参数。我如何使用htaccess来做到这一点?我使用的是PHP。使用htaccess重定向特定页面
任何帮助非常感谢,谢谢!
这很可能是这样的:
RewriteRule ^sites-related-to-(\w+)-(\d+)\.html$ /somewhere_else.php?place=$1&pos=$2 [L]
/sites-related-to-
将是URLRedirectMatch sites-related-to-([^-]+)-(\d+)\.html$ http://www.anotherserver.com/something.php?country=$1&id=$2
未经检验的,看到RedirectMatch
。
RewriteRule ^sites-related-to-(\w+)-(\d+).html/$ sites-related-to.html?country=$1&val=$2 [L]
我要试着让你知道,谢谢。 – VKGS
最初你的方法没有工作,然后我改变它,RewriteRule ^网站相关的 - (\ w +) - (\ d +)\。html somewhere_else.php?place = $ 1&pos = $ 2 [L]工作。 htaccess和somewhere_else.php都在public_html文件夹下。你和我的方法有什么不同? – VKGS
我刚刚在答案中解决了这个问题,但我在开始时意外地加了一个'/'。 – cwallenpoole