Reputation: 81
I want to turn these URLS:
/mysite/site1/offer/
/mysite/site1/offer/?name=tom&[email protected]
into to this:
/mysite/site1/?page=offer
/mysite/site1/?page=offer&name=tom&[email protected]
Where '/site1/' will be dynamic and so that wordpress ignores '/offer/' and instead passes a url parameter to the custom template.
Can this be done?
I tried this but it doesn't work:
RewriteRule /mysite/([^/]+)/([^/]+)/$ /mysite/$1/?pg=$2 [L,QSA,NC]
But I know it's missing the bit to capture the other url params but not sure how to write this.
Any help is greatly appreciated. Thanks!
EDIT: I'm using RewriteBase instead of /mysite/
So this is what the new rule looks like:
RewriteBase /mysite/
RewriteRule ^([^/]+)/([^/]+)/$ /$1/?pg=$2 [L,QSA,NC]
Upvotes: 0
Views: 26
Reputation: 143886
In an htaccess file, the leading slash of a request is stripped off before rewrite rules are applied to it, that means you need to get rid of the leading slash:
RewriteRule ^mysite/([^/]+)/([^/]+)/$ /mysite/$1/?pg=$2 [L,QSA,NC]
Upvotes: 1