I need to rewrite a URL using an .htaccess and the URL has two query strings. Here is my raw URL:
http://domain.com/channel-partners/en/index.php?location=phoenix-az&name=company
How do I get that to be written as:
http://cp.domain.com/phoenix-az/company
This will redirect URLs in the format
partners/location/namewith an optional trailing slash to the raw URL you provided.locationandnamecan be alphanumeric, underscore, or dash characters.Note: I have prefixed the URL with the literal
partners. Without it your RewriteRule would be too loose and match nearly all requests. Feel free to change it.UPDATE
To redirect from your sub-domain, the above needs to be in the .htaccess file for cp.domain.com. You’ll need to modify your RewriteRule to the following:
However, I really don’t recommend this. Link management is going to be a nightmare. You should really try to have all these links under the same domain. 301 Redirect from the sub-domain if you have to.