Title: [SOLVED] mod_rewrite / codeigniter / wildcard subdomains Post by: Cyberdyne on March 25, 2013, 01:37:59 PM I have been searching for hours for the correct solution to this unsuccessfully so hopefully someone here might be able to help.
I need to be able to have separate, 100% fully working codeigniter installations on wildcarded subdomains. Example: Code: http://www.domain.com -> reads from /var/www/domain.com/public_html/index.php
Virtual hosts have been set up as follows: Code: <VirtualHost x.x.x.x:80> I've tried putting this under /var/www/domain.com/sub/.htaccess: Code: RewriteEngine On The first part correctly redirects to the correct website depending on the subdomain used, but the second part (which codeignieter needs to remove the 'index.php' from urls and to find the controllers, does not work here. I'm not interested in hardcoded solutions. Do not write literal strings such as 'abc' or 'xyz' anywhere. Also would rather not get into custom routing in the individual applications. (Unless it's just a 1 or 2 line regex sort of deal). Nowhere I've looked on the web matches my situation exactly, but here's some stuff I've read: http://snipplr.com/view/18613/ http://codeblow.com/questions/codeigniter-and-rewriterule-problem/ http://www.codepursuit.com/?p=178 http://ellislab.com/forums/viewthread/89424/ Ideally, someone will be able to figure all this out on their local machine and make a zip of the entire thing for me. Thanks for reading. Title: Re: [BOUNTY] 2 BTC mod_rewrite / codeigniter / wildcard subdomains Post by: Bitsky on March 25, 2013, 01:49:55 PM Maybe it's because of your first '[L]' flag?
It's used to stop processing the rule set. So your subdomain rewrite matches and then the rewrite engine exits. Title: Re: [BOUNTY] 2 BTC mod_rewrite / codeigniter / wildcard subdomains Post by: Cyberdyne on March 25, 2013, 01:52:14 PM Removing that resulted in 404 on the various home pages. http://abc.domain.com/
Title: Re: [BOUNTY] 2 BTC mod_rewrite / codeigniter / wildcard subdomains Post by: Cyberdyne on March 25, 2013, 02:04:28 PM Maybe it's because of your first '[L]' flag? It's used to stop processing the rule set. So your subdomain rewrite matches and then the rewrite engine exits. Closed, but anyway, tip sent. It wasn't related to the solution, but thanks very much for taking the time to check it out. The solution was to have an extra .htaccess file under each subdomain, like a normal codeigniter installation should, and have the 2 different mod_rewrites in different .htaccess files... one in the main sub folder, and then one in each application, doing the codeigniter thing. Title: Re: [BOUNTY] 2 BTC mod_rewrite / codeigniter / wildcard subdomains Post by: Bitsky on March 25, 2013, 02:19:14 PM Closed, but anyway, tip sent. It wasn't related to the solution, but thanks very much for taking the time to check it out. Thanks. I started to play around to see if I could stuff it into a single htaccess, but it's probably easier that way.The solution was to have an extra .htaccess file under each subdomain, like a normal codeigniter installation should, and have the 2 different mod_rewrites in different .htaccess files... one in the main sub folder, and then one in each application, doing the codeigniter thing. |