-1

the subdomains are not working on the hosting that include this htaccess file

this code file ".htaccess":

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f  [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^(.*)/cgi-bin/(.*?)/ $2.php?lang=$1 [L,NC,QSA]

I want as follows: https://example.com/us/cgi-bin/index/ to https://subdomin.example.com/us/cgi-bin/index/

Depending on the above file ".htaccess".

Please help me to fix that

developer__c
  • 628
  • 3
  • 11
  • 30
  • Define "isn't working" better. Have you actually set up DNS to point subdomains at your server correctly? – deceze Feb 04 '15 at 10:57
  • Again: is your DNS actually set up to provide subdomains? If you have no idea what that means, then the answer is probably *no*. Investigate that first. – deceze Feb 04 '15 at 11:06

1 Answers1

0

Please try the below code with your domain values

RewriteCond %{ENV:REDIRECT_SUBDOMAIN} ="" 
RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.domain\.com\.?(:80)?$ [NC] 
RewriteCond %{DOCUMENT_ROOT}/%1 -d 
RewriteRule ^(.*) %1/$1 [E=SUBDOMAIN:%1,L] 
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
Veerendra
  • 2,540
  • 2
  • 21
  • 39