Bhumi Shah
Bhumi Shah

Reputation: 9474

mod_rewrite for SEO friendly URL using htaccess

I am trying to write SEO friendly URL of below URL.

www.url.com/item.php?id=_84_113_112&lang=en

I have written below code:

RewriteRule ^(.*)/(.*)/$ item.php?id=$2&lang=$1 [QSA,L]

But not working, can anyone help?

Upvotes: 0

Views: 53

Answers (2)

G San
G San

Reputation: 81

You can use this -

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ item.php?id=$1&lang=$2

Upvotes: 0

Alok Patel
Alok Patel

Reputation: 8032

Probably extra / at the end (before $) is the problem.
Change it to like this.

RewriteRule ^(.*)/(.*)$ item.php?id=$2&lang=$1 [QSA,L]

Upvotes: 1

Related Questions