Create subcategory sub-map
The first thing you need to do is create a subdomain of the * .apps.domain.com subdirectory.
(If you are using Nameservers, skip this step!) Log in to your domain name registrar and create an A record for * .apps.domain.com (yes, an asterisk) and point it to the server IP address. Please note that distribution may take up to 48 hours.
Log in to your web hosting account and go to the "Subdomains" menu in the Domains section. Create a Subdomain * .apps.domain.com that points to the /public_html/domain.com/apps folder as the Root Document . And wait until the spread is over.
Visit How to create a substitution subdomain in cPanel and How to create a Sub-Subdomain for more information. If your server configuration did not allow you to create a substitution subdomain, simply create * .domain.com and point it to "/public_html/domain.com/apps".
Rewrite wildcard subdomain
Place these directives in the .htaccess file of the document root from the * .apps.domain.com wildcard, which in this case is "/public_html/domain.com/apps".
RewriteEngine on RewriteCond %{HTTP_HOST} ^(.+)\.apps\.domain\.com RewriteRule (.*) http://domain.com/apps/%1/$1 [QSA,P,L]
%1 is a numbered trackback (.+) , And $1 is (.*) . You must enable the [P] flag if the URL is rewritten from a specific domain http: // domain.com/apps/%1/$1 on the same server, without which it will be redirected. Use the [QSA] flag if you intend to use the query string of the rewritten wildcard subdomain. Visit P | proxy and QSA | qsappend for more information about them. And just adjust some setting, if I forget something, besides this, this is a server error.
A bit to think about
You must configure your .htaccess file for duplicate subdomains that will exist, such as otherwildcard.apps.domain.com, another.wilcard.apps.domain.com and other.deep.level.apps. domain.com, which will duplicate apps.domain.com, since they all have the same document root. Set up redirection or tell the client that these subdomains do not exist.
5ervant
source share