tags:

views:

26

answers:

1

I have some problem with my .htaccess file. Here I am adding my problem. Please help me.

My actual URL is as follows http://localhost/buydualit/?searchitem=toaster&pagenum=1 here by using my .htaccess am rewrited my URL as http://localhost/buydualit/toaster-1/

My URL rewriting rule is like follows:

RewriteRule ^[A-Za-z-0-9,\"'-\/]+\-([0-9]+)\/$ buydualit/index.php?pagenum=$1&searchitem=$2

In this rule how can I retrieve toaster from http://localhost/buydualit/toaster-1/ (searchitem=$2 which is not getting)? Please help me.

A: 

Put parentheses around the parts of the expression you want. I removed the / char from your set of characters so it'd not grab the buydualit/ part of the url, and put it outside the grabbing section. Finally, the grabbed parts are numbered sequentially, so you have to switch $1 and $2

RewriteRule ^buydualit/([A-Za-z-0-9,\"'-]+)-([0-9]+)\/$ buydualit/index.php?pagenum=$2&searchitem=$1

Also, this probably doesn't belong here, as it's more of a system administration question than a software development question.

Arne Sostack