Wildcard subdomain .htaccess and Codeigniter?

This should work. Please test and let me know if it works: RewriteEngine On RewriteCond %{HTTP_HOST} ^^. +\.

Domain\. Com$ RewriteRule ^(.+) %{HTTP_HOST}$1 C RewriteRule ^(^. +)\.

Domain\. Com(.*) /$1$2 L RewriteRule ^(.*) /home$1 L.

Thanks takinbo, unfortunately that did not work. It resulted in a Server 500 (Request exceeded the limit of 10 internal redirects due to probable configuration error) – Gautam Jan 8 at 21:17 I'll run a test on this and figure out the correct combination. – takinbo Jan 12 at 15:01.

Ok, I believe I have solved it. Here's what I have so far. First the .

Htaccess RewriteEngine On RewriteBase / # if REQUEST_URI contains the word "user" and the # SERVER_NAME doesn't contain a ". " re-direct to the root # The reason this is done is because of how the last two rules # below are triggered RewriteCond %{REQUEST_URI} (user) NC RewriteCond %{SERVER_NAME}! \.

RewriteRule (.*) / L,R=301 # Allow files and directories to pass RewriteCond %{SCRIPT_FILENAME}! -d RewriteCond %{SCRIPT_FILENAME}! -f # Codeigniter rule for stripping index.

Php RewriteCond $1! ^(index\. Php|images|robots\.

Txt) RewriteRule ^(.*)$ /index. Php/$1 C # Force wild-card subdomains to redirect. # E.g.

http://me. Domain/foo/bar/123 as http://domain/user/me/index. Php/foo/bar/123/bar/123/ RewriteCond %{HTTP_HOST} ^(a-z0-9-+).

Domain NC RewriteRule (.*) /index. Php/user/%1/$1/ L And finally routes. Php As you can see from above everything works.

The only thing I can't figure out is why the last arguments are repeated when I use a subdomain? If I do: http://domain/foo/bar/123 Then my PATH_INFO is shown as /foo/bar/123/ which is perfect But if I do: http://me. Domain/foo/bar/123 Then my PATH_INFO is shown as /user/me/index.

Php/foo/bar/123/bar/123/ Which for the most part is OK but why is the parameters repeating in the end? So yea overall I think it's working. Only thing I'll have to do is have several routes for any controllers I add to my \controllers.

Unless there's a way around it?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions