开发者

How to use strings in RewriteCond

开发者 https://www.devze.com 2023-02-04 13:51 出处:网络
My .htaccess: Options FollowSymLinks RewriteEngine On RewriteCond %{QUERY_STRING} ^.*pg=p&kat=test&pod=1.*$

My .htaccess:


Options FollowSymLinks
RewriteEngine On    
RewriteCond %{QUERY_STRING} ^.*pg=p&kat=test&pod=1.*$
RewriteRule ^(.*)/(.*)/开发者_运维百科$ index.php?pg=p&kat=$1&pod=$2

doesn`t work, why ?

I tested this one:

RewriteCond %{QUERY_STRING} .*

And it works, so apache is ok.


RewriteRule needs to go on a new line.

Your rewrite condition says the query string should match

.pg=p&kat=test&pod=1.

and then your rewrite rule tries to match on

^something/something/

Surely that should be

^/(.)/(.)/$ 

?

so... what URL are you hitting?


Sorry, rewritecond, what i have:


RewriteCond %{QUERY_STRING} ^.* pg=p&kat=test&pod=1.* $ 
RewriteRule ^(.*)/(.*)/$ index.php?pg=p&kat=$1&pod=$2

Space between (" * " and "pg") and (" * " and "$") doesn`t exists in .htaccess file

ofcourse RewriteRule is in new line

I`m hitting URL: www.test.pl/tested/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消