Reputation: 11
My original page without rewrite was trying to pass 4 variables. I only want 2 of the four to be used within the rewrite (state and area) and still pass the two that I can $_REQUEST on the page. I got my original 2 working with a rewrite but I still cannot figure out the two passed variables. Once I added the content for variables, I'm getting page not found so obviously written wrong. Is my syntax wrong on the requests? Thanks in advance for any help.
Some data for troubleshooting.
RewriteRule ^([A-Z][A-Z])/(.*)/directory.php?type=(.*)&sortby=([A-Za-z]+)$ /company.php?area=$2&state=$1&type=$3&sortby=$4 [L]
I would like my final rewrite to look like this.
/IL/Chicago/directory.php?type=all&sortby=gcs
And request variables on the page for: type (variables options are all, 1-4) and sortby (gcs or cn)
Upvotes: 1
Views: 883
Reputation: 4237
Hy, Try this variant:
RewriteRule ^/([A-Z][A-Z])/([a-z]+)/directory.php?type=([a-z]+)&sortby=([A-Za-z]+)$ /company.php?area=$2&state=$1&type=$3&sortby=$4 [L]
Upvotes: 2