Question: In my public\_html I have a *profile.php* file and some links in this format  

```
domain.com/shop/index.php?c=amazon&id=2

```

that lead to the amazon shop with category id 2

In a folder inside public\_html, named *shop* I have *index.php* that shows the products of the 2 category.

However instead of the above ugly link I want to have something in the format of

```
domain.com/shop/company/category-id
e.g. domain.com/shop/amazon/2

```

I don't want to have *profile.php* and *shop.php* in the same folder because I have another RewriteRule in there.

What is the RewriteRule I have to use in this case of two variables? Thank you

Answer: 
You'll want to create a `.htaccess` file in the `shop` directory that include the following:

```
RewriteEngine On
RewriteRule ^([^/]+)/(\d+)$ index.php?c=$1&id=$2

```
This should work:

```
RewriteEngine On

RewriteRule ^([a-zA-Z0-9]+)/([0-9]+)$ index.php?c=$1&id=$2

```

Or you you could move the `index.php` back into `public_html` and name it `shop.php`, and do this:

```
RewriteEngine On

RewriteRule ^shop/([a-zA-Z0-9]+)/([0-9]+)$ shop.php?c=$1&id=$2

```