CodeIgniter Forums
Domain routing possibilities in CI? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Domain routing possibilities in CI? (/showthread.php?tid=7248)

Pages: 1 2 3


Domain routing possibilities in CI? - El Forum - 04-11-2008

[eluser]Sean Murphy[/eluser]
Why do you still need that block of code? Are you pointing more than one domain at the same code base?


Domain routing possibilities in CI? - El Forum - 04-11-2008

[eluser]stevefink[/eluser]
Hi sean,

Not entirely sure what you mean why do I still need that block of code. That block above is the one that's routing the URL I'm looking to map properly.


Thanks again,


/sf


Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]lonka[/eluser]
Hi,
I try the same way to do something similar but I got error 500.

Is it possible to make with mod_rewrite that subdomain for example %username%.domainname.com
will be pointing to domainname.com/users/%username% ?


Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]Sean Murphy[/eluser]
Code:
RewriteCond %{HTTP_HOST} ^([^\.]+)\.
RewriteRule ^(.*)$ /index.php?/users/%1/$1 [L]

That should make seanmurphy.example.com/dashboard go to example.com/index.php/users/seanmurphy/dashboard. If you plan to use other subdomains or www you'll need to make some adjustments.


Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]lonka[/eluser]
I only want that www.example.com and example.com go to => www.example.com
and someone.example.com/dashboard should read from example.com/users/someone/dashboard


Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]Sean Murphy[/eluser]
Hopefully this will work for you...
Code:
RewriteCond %{HTTP_HOST} ^((?!www\.)[^\.]+)\.
RewriteRule ^(.*)$ /index.php?/users/%1/$1 [L]



Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]lonka[/eluser]
And should I add this or replace or mix with one that I already have in .htaccess?

My file:

Code:
RewriteEngine on

RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|js|css)
RewriteRule ^(.*)$ index.php/$1 [L]



Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]Sean Murphy[/eluser]
You can try this and see how it works. Keep in mind that I haven't tested it myself.
Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^((?!www\.)[^\.]+)\.
RewriteRule ^(.*)$ index.php/users/%1/$1

RewriteCond $1 !^(index.php|images|robots.txt|js|css)
RewriteRule ^(.*)$ index.php/$1

RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
BTW, why do you need...
Code:
RewriteCond $1 !^([a-zA-z0-9/])



Domain routing possibilities in CI? - El Forum - 05-05-2008

[eluser]lonka[/eluser]
[quote author="Sean Murphy" date="1210031824"]You can try this and see how it works. Keep in mind that I haven't tested it myself.[/quote]
Thank you, I will test this and see what happensSmile

[quote author="Sean Murphy" date="1210031824"]
BTW, why do you need...
Code:
RewriteCond $1 !^([a-zA-z0-9/])
[/quote]
I don't know mod_rewrite, but I suppose that this is to allow only letters and numbers? I get this from google, so it could be wrong.


Domain routing possibilities in CI? - El Forum - 05-07-2008

[eluser]lonka[/eluser]
Unfortunately I have got 500 Internal Error again Sad
When I delete line with
Code:
RewriteCond %{HTTP_HOST} ^((?!www\.)[^\.]+)\.
error 500 is gone.
I try to change rule to
Code:
RewriteCond %{HTTP_HOST} ^((?!www\.)[^\.]+)\.$
but this is no working as we are expecting Sad