结合多个htaccess重写

时间:2011-09-02 15:53:13

标签: php apache .htaccess mod-rewrite redirect

  

可能重复:
  Dynamic rewrites in htaccess file

我目前正在处理一个相当严厉的重定向,这让我发疯。

我希望从这个网址获取:

/news/give-your-blog-the-google-treatment-$21378233.htm

到此:

/industry-news/small-business-online-marketing/give-your-blog-the-google-treatment/800717101

其中give-your-blog-the-google-treatment是从两个网址中的数据库生成的,其中small-business-online-marketing800717101是从数据库为新网址生成的。

因此,到达第二个url的唯一方法是在执行重定向之前从我的数据库中获取一些数据。所以我想我需要做一些重定向:

/news/give-your-blog-the-google-treatment-$21378233.htm

类似于:

/redirect/index.php?name=give-your-blog-the-google-treatment

然后我可以$_GET['name']从数据库中获取详细信息并最终执行PHP 301重定向以获取我想要的URL:

/industry-news/$cat/$name/$id

所以我认为我几乎已经将它背后的理论排序了,但实际的编码我没有任何线索,以及如何测试它是否有效...再次陷入困境。如果有人能提供帮助就会很棒。

由于

0 个答案:

没有答案
相关问题