Beginner Url Rewrite htaccess

后端 未结 3 1471
孤街浪徒
孤街浪徒 2021-01-16 10:21

I would simply like to rewrite all requests from:

http://example.com/products/product.cfm?id=product-name

to

http://example         


        
3条回答
  •  醉话见心
    2021-01-16 10:59

    Using mod_rewrite, you could write:

    RewriteRule ^products/([\w-]+)$ /products.cfm?id=$1&%{QUERY_STRING}
    

    This will do the translation you wanted, while preserving other parameters in the original URL. It won't handle categories, but I'm not sure you can have those both in operation simultaneously as you described.

提交回复
热议问题