UrlRewrite 3 GET请求

编程入门 行业动态 更新时间:2024-10-24 18:18:34
本文介绍了UrlRewrite 3 GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我工作的一个项目,并停留在urlrewrite。我尽全力也没找到答案,希望能在这里得到解决。

I'm working on a project and stuck on urlrewrite. I tried my best didn't find the answer, hope to get the solution here.

  • 我创建通过单一的category.php页面的动态类别。我要创建3种类型的这个样子,

  • I am creating dynamic categories via single "category.php" page. I want to create 3 types of categories like this,

    • mysite/maincategory.html (这是主要类别中,有其中22)

    • mysite/maincategory.html (This is main category there are 22 of them)

    mysite/maincategory/firstsubcategory.html (apprx。700-800子)

    mysite/maincategory/firstsubcategory.html (apprx. 700-800 subcategories)

    mysite/maincategory/firstsubcategory/secondcategory.html (apprx。700-800子)

    mysite/maincategory/firstsubcategory/secondcategory.html (apprx. 700-800 subcategories)

    我创建了一个category.php网页,其中接收 $ _ GET ['主'] , $ _ GET ['firstsub ] 和 $ _ GET ['第二次'] 和的.htaccess ,

    I created a "category.php" page which receives $_GET['main'], $_GET['firstsub'] and $_GET['second sub'] and used following codes in .htaccess,

    Options +FollowSymLinks RewriteEngine On RewriteRule (.*).html category.php?main=$1

  • 我试过 mysite/categoryname.html ,但没有奏效。我已经成功地使用上面的$ C $下我的其他项目,并运行良好。但是,这是第一次我正与 3 $ _GET ['主'] 我不知道它是如何工作的。

  • I tried mysite/categoryname.html but didn't worked. I've successfully used above code for my other project and worked fine. But this is first time I'm working with 3 $_GET['main'] am not sure how it works.

    请帮我解决我的问题。

    Please help me to solve my problem.

    推荐答案

    有关的......让我查一下......是是,10日时间:

    For the... let me check... yes yes, 10th time:

    请尝试使用 RewriteLog 指令:它可以帮助您追踪到这样的问题:

    Please try to use the RewriteLog directive: it helps you to track down such problems:

    # Trace: # (!) file gets big quickly, remove in prod environments: RewriteLog "/web/logs/mywebsite.rewrite.log" RewriteLogLevel 9 RewriteEngine On

    而现在的解决方案:

    And now the solution:

    Options +FollowSymLinks RewriteEngine On RewriteRule download-game/(.*)\.html$ category.php?main=$1 [QSA,L] RewriteRule ([^/]*)/([^/]*)/([^/]*)\.html category.php?main=$1&firstsub=$2&secondsub=$3 [QSA,L] RewriteRule ([^/]*)/([^/]*)\.html category.php?main=$1&firstsub=$2 [QSA,L] RewriteRule ([^/]*)\.html category.php?main=$1 [QSA,L]

    请告诉我,如果它的工作原理。

    Please tell me if it works.

  • 更多推荐

    UrlRewrite 3 GET请求

    本文发布于:2023-11-01 02:27:19,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1547990.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:UrlRewrite

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!