Welcome Guest, Not a member yet? Register   Sign In
Check if at root domain
#11

[eluser]TheFuzzy0ne[/eluser]
I think you should stick to preg_match() for now, but create a custom controller than checks the subdomain, and redirects to the splash page if there isn't one.
#12

[eluser]TheFuzzy0ne[/eluser]
I'm no expert, but I threw this together. Perhaps it will work as expected?
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_HOST} !^rent\.
    RewriteCond %{HTTP_HOST} !^sales\.
    RewriteRule ^$ index.php/select_site [L]
</IfModule>

It will probably need integrating with your existing htaccess file. It should (in theory) redirect to a "select_site" controller if neither rent or sales are present in the subdomain.

If you can paste your existing htaccess file, I can show you where I think it needs to go.
#13

[eluser]Dauntless[/eluser]
My current one is this:
Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
(It should be a standard .htaccess script to hide the index.php)


And I would still need to override base_url: I anchor() etc and those are based on base_url. I HAVE to add the subdomain to the baseurl, otherwise every link would go to the splash screen. It this possible ?
#14

[eluser]TheFuzzy0ne[/eluser]
Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^rent\.
RewriteCond %{HTTP_HOST} !^sales\.
RewriteRule ^$ index.php?/select_site [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
Hopefully this will work for you.

You can set the base_url dynamically by adding something like this in your config.php.
Code:
$config['base_url'] = $_SERVER['HTTP_HOST'];
The above code is untested.




Theme © iAndrew 2016 - Forum software by © MyBB