2021年3月11日星期四

rewrite rule for an URL with 2 queries

Hi,

My URL looks like this:

example.com/index.php?f=directory&s=page  

I want it to be like this instead:

example.com/directory/page  

my rewrite rules look like this right now:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ index\.php\?s=([^\s]*)  RewriteRule ^/?(.*?)/?$ %1?%2%3 [L,R=301]  

it appears to work but not quite because if I call the queries in PHP I get something like this:

print $_GET['f'] */ it prints nothing  print $_GET['s'] */ it prints directory/page  

which is not what I intend. How can I fix it?

Thank you.

https://stackoverflow.com/questions/66592762/rewrite-rule-for-an-url-with-2-queries March 12, 2021 at 09:06AM

没有评论:

发表评论