0
votes

I configured a Joomla in my IIS server.

I would likes to add a custom SEO friendly URL to my application, I corrected this using apache and working fine. But I am new to ISS and I had a doubt in rewriting URL.

I enabled the url rewrite option in Joomla! and created a clean url like this

http://www.sitename.com/shop?shop=3

My requirement is

Current URL : http://www.sitename.com/shop?shop=3 ( fetching the data using the shop's PK 3 )

I would likes to rewrite it to

http://www.sitename.com/shop/3/shop-seo-name

When user click this link then I need to go to shop-component/shop-view then fetch the data using the PK 3

I had the code to rewrite here

<rule name="MyRule">
  <match url="^shop?shop=[0-9A-Z]" />
  <action type="Rewrite" url="index.php" />
</rule>

But this is not working Any idea?

1

1 Answers

1
votes

You will need to use conditions for the query strings, like so:

<rule name="MyRule">
    <match url="^shop" />
    <conditions>
        <add input="{QUERY_STRING}" pattern="^shop=([0-9A-Z]+)$" />
    </conditions>
    <action type="Rewrite" url="index.php" />
</rule>