Wildcard Subdomains using htacess with multiple variables

  .htaccess, php, subdomain, wildcard

I have actually written a htaccess rewrite rule for creating wildcard subdomain from get method but the problem is that I can’t use any other get variable on the page.

here is the website
https://mywebsite.efficientpoint.com/test_view?id=cloth

variable id is undefined

test_view.php

$id= $_GET[‘id’];

$sitePostName = $_GET[‘url’];

    <h1>The website url is (<?php echo $sitePostName; ?>)</h1>
    <h4>The product is (<?php echo $id; ?>)</h4>

.htaccess

RewriteRule ^([aA-zZ])$ test_view.php?url=$1

RewriteCond %{HTTP_HOST} ^(^.*).efficientpoint.com

RewriteRule (.*) test_view.php?url=%1

OUTCOME:

The website url is (mywebsite)
The product is ()

So you see the bracket for product is blank.

Please I will be grateful if anyone can help me out there.
Thank you.

Source: Ask PHP

LEAVE A COMMENT