我工作的一个项目,并停留在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请求
发布评论