Welcome Guest, Not a member yet? Register   Sign In
Identify from which hosting account the request comes (htaccess, maybe?)
#1

[eluser]mvdg27[/eluser]
Hi guys,

I'm looking for a smart solution for the following situation:

I'm using an httpd redirect to point all the traffic from different hosting accounts to a central CI script on my webserver:

Code:
Alias /index.php /home/user/public_html/folder/index.php

That all works fine, but now I'm looking for a way to identify from which hosting account the request comes. I could do this by simply checking the $_SERVER['HTTP_HOST'] variable, but I think that could become complicated when I have several domain aliases.

Now I'm thinking I might use a htaccess file to solve this, by adding a unique key to identify the website, as such:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|www)
RewriteRule ^(.*)$ /index.php/$1?key=my-key [L]

Two problems I see with this:

- I'll have to enable query strings (is it recommended to do this?)
- The htaccess doesn't work for the initial index.php

Anyone any thought on this?

Thanks! Michiel




Theme © iAndrew 2016 - Forum software by © MyBB