谁能告诉我我到底做错了什么?

试图采取:

1 search .php? key = 23 &category =testing

并制作:

1 / 23 /testing .html

用这个:

1 RewriteRule ^ ( [^ / ] * ) / ( [^ / ] * )\\ .html$ /? key =$ 1 &category =$ 2 [L ]

对于我的生活,我无法解决这个问题……或者如果有更好的方法,请指出正确的方向。

** 更新

好的,在放弃这个之后,我终于联系了托管公司,看看我的域是否有问题导致它无法正常工作。这是他们告诉我的:

  • You do not have a rewrite condition and you only have a simple rewrite. For the code to >always work properly you should normally set a”RewriteCond” with a valid pattern.

  • You have used the”?” question mark character in your code although this is an escape >character and doing so would only cause a rewrite to index.php based upon your code as >everything after the question mark gets escaped.

  • Please consider using a”RewriteCond” in your code and also use regexes to properly escape >the”?” character and avoid unexpected behavior.

    谁能帮帮我?谢谢!



    相关讨论

    • 确保将 R 放入参数 [L,R] 中。我通常构建一个快速的自定义 MVC 并让每个请求都通过 index.php。这样我就可以编写出我的永久链接。
    • 仍然没有骰子。我不需要对我的 PHP 文件做任何其他事情吗?我可以得到一个简单的 hmtl 重定向来工作,所以我知道路径等正在工作……但对于我的生活,我无法弄清楚为什么这不起作用..
    • 我相信重写规则应该以 ^/ 开头。


    1 RewriteRule ^ / ( [^ / ] * ) / ( [^ / ] * )\\ .html$ /? key =$ 1 &category =$ 2 [L ,R ]

    声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。