关于 apache:使用 PHP 获取值的简单 mod 重写

Simple mod rewrite with PHP Get values

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

试图采取:

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.

    谁能帮帮我?谢谢!


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

    原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/268557.html

    (0)
    上一篇 2022年6月20日
    下一篇 2022年6月20日

    相关推荐

    发表回复

    登录后才能评论