Welcome Guest, Not a member yet? Register   Sign In
Domain routing possibilities in CI?
#11

[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?
#12

[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
#13

[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% ?
#14

[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.
#15

[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
#16

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

[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]
#18

[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/])
#19

[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.
#20

[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




Theme © iAndrew 2016 - Forum software by © MyBB