Please I really need help.
I have written the htaccess code that will create wildcard subdomains using get method for the product page But am actually trying to pass another variable in the get method to make it two variables yet the second variable is not seen.
This is what i want https://mywebsite.example.com/product.php?id=cloth
Also, what are the values of $_GET['id'] and $_GET['url'] in https://mywebsite.example.com/product.php?id=cloth for example, and which values would you expect?
Well, the RewriteCond is matching against a subdomain and passing it as a parameter in the following RewriteRule. Not really what RewriteCond was meant for, but it’s oftentime (ab)used to do this sort of thing anyway.
However, the htaccess is working very well with the first get variable which is the url but it doesn’t accept any other variable as a get method.
I have been trying to rewrite the rule in a way that it will accept two variables as get method, one used as subdomain and the other used as a get method with a parameter like ?id=cloth
for proper explanation, here is the domain am using, you can access it. https://mywebsite.efficientpoint.com/test_view?id=cloth
Noooo. I don’t want to replace url with id. I want to get the value of Id on the page using get method. While the url function will still remain as subdomain.
The function of Url is to derive subdomain while id is to fetch a particular product from the database being inserted by the user with url.
for e.g
We have a user in the database with a name = john and slug_url = mywebsite
John inserts products into a table called product_table.
while inserting, his slug_url is saved in the database.
The problem I have is that I don’t really know how to rewrite htaccess to accept other get variables apart from url. It’s only url that is being defined.
Looking through this thread, I kept thinking that the %1 value is constantly being reevaluated BECAUSE mod_rewrite does not stop until there are no more matches.
The code above (from rpkamp) matches a subdomain (IF IT EXISTS) before the dot separator for the domain but requires no dot character in the {REQUEST_URI} to provide a redirection to {subdomain}.efficienthost.com/test_view.php?url={subdomain}&id={REQUEST_URI}.
I’m not sure why rp included the Options (other than good practice) nor the double ^ for the subdomain. Also, I vastly prefer designating the allowed characters in the subdomain string, including the dot separator. Making the subdomain required via the RewriteCond is correct (but the * makes all but the dot separator optional).
Question. Are you trying to rewrite to efficienthost.com? With or without www? with gold?
In other words, please give an example of the submitted URL (with subdomain) and the desired URL (after redirection) for a better answer.