I'm currently using CodeIgniter 3. I want to create dynamic subdomains like team1.domain.com
, team2.domain.com
, etc.
These domains need to point to the controller Team
and a specifically to the show_Team
method in the that controller.
I have read several QAs on StackOverflow, but none of them seem to work for me.
Currently, I have:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ./index.php [L,QSA]
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).domain.com [NC]
RewriteRule (.*) /index.php/team/$1/ [L,QSA]
And as route:
$route['team/(:any)'] = "Team/show_Team";
But this gives me a 500 internal error.
Several slightly different options posted on StackOverflow are also not working.
Update
The error log gives me:
[Wed Jan 04 09:52:15.013871 2017] [core:error] [pid 4792:tid 1332] (OS 123)The filename, directory name, or volume label syntax is incorrect. : [client 127.0.0.1:61066] AH00132: file permissions deny server access: proxy:http://team1.domain.com/Team/show_Team/, referer: team1.domain.com/Team/show_Team/
When I updated it to (as given in the comments):
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.domain\.com$ [NC]
RewriteRule (.*) /index.php/team/$1/ [L,QSA]
It gives me this error:
[Wed Jan 04 10:01:35.959839 2017] [core:error] [pid 4792:tid 1320] [client 127.0.0.1:61351] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://team1.domain.com/