Hello, i would like to know if there is a way to, through virtual hosts, to redirect the visitor to the set of categories belonging to a specific user.
The idea is to have a subdomain to each member of the family, and, for instance, if someone accesses the subdomain dinis.emviagem.com it is redirected to my part of the gallery, and if someone accesses my wife's subdomain, ana.emviagem.com, goes to her part of the gallery, and so on.
I am hosting the website at home, with apache2, php5 and mysql5, so any changes in the server are possible.
Thanks in advance for any help.
Dinis
You wouldn't need to use virtual hosts. You'd just need to add some code into init.inc.php to see what subdomain the request went to and set the album/category accordingly.
Hello Nibbler,
if you could be a bit more precise, it would be great. I'm new to this and i need some guidance. ???
How to i see what subdomain the request went to?
How do i set the album/category accordingly?
What code should i add to init.inc.php?
Thanks,
Dinis
Maybe add something like this at the end of the file.
$parts = explode('.', $_SERVER['HTTP_HOST']);
$subdomain = $parts[0];
$categories = array(
'dinis' => 3,
'ana' => 5,
);
if (isset($categories[$subdomain])) $_GET['cat'] = $categories[$subdomain];
You'd need to set the correct category numbers in the code.
Thank you Nibbler, it seems to be a good direction pointing towards what i need.
One more question: In the solution you gave me, it only allows me to have one category per user.
Do you think it is possible to retrieve all the categories belonging to a specific user id? :)
Thank you once again,
Dinis
Not without modifying core code. Perhaps you could place all such categories under a master category for each user.
Nibbler, you are the men. Thank you very much. After i wrote the last post, i saw how imbecile the question was.
Thank you for your patience.
Regards,
Dinis