简体   繁体   中英

Converting a windows web.config rule to an .htaccess rule

I have the following rule in a web.config file on a windows machine. It takes any request that contains http://domain.com/shop/[stuff] and routes it to /category.php . I am moving the site to a PHP server, but I'm not sure how to make this rule an .htaccess rule.

Note that the web.config rule keeps the query string if it is present.

    <rule name="Rule for shop pages.">
      <match url="(.*/)?shop/*" />
      <action type="Rewrite" url="/category.php" appendQueryString="true" />
    </rule>

Try the following

RewriteRule (.*/)?shop/* /category.php []

For more help in the future I recommend you to use http://tohtaccess.com/ a website to convert web.config rewriting rules into htaccess format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM