PHP_SELF and dirname function behavior. Hint Please!
Posted: Wed Apr 14, 2010 11:07 pm
Hello all,
I created a folder with a file that works as a redirect function, so the users do not need to learn a long login link.
Here is the file content and the syntax of the function:
<?php
header('Location: ' . dirname(dirname($_SERVER['PHP_SELF'])) . '/index.php?option=com_user&view=login');
The folder name is /login and it is located on the domain's root folder.
When users go through the main domain it works like a charm:
If they enter:
www.domain.com/login
They are redirected to:
www.domain.com/index.php?option=com_user&view=login
which is what I want.
-------BUT
When they go through a subdomain:
subdomain.domain.com/login
They are redirected to:
http://www.index.php/?option=com_user&view=login
I do not understand this difference on the result.
It should do the same! Please help!
Any ideas?
Thank you all!
I created a folder with a file that works as a redirect function, so the users do not need to learn a long login link.
Here is the file content and the syntax of the function:
<?php
header('Location: ' . dirname(dirname($_SERVER['PHP_SELF'])) . '/index.php?option=com_user&view=login');
The folder name is /login and it is located on the domain's root folder.
When users go through the main domain it works like a charm:
If they enter:
www.domain.com/login
They are redirected to:
www.domain.com/index.php?option=com_user&view=login
which is what I want.
-------BUT
When they go through a subdomain:
subdomain.domain.com/login
They are redirected to:
http://www.index.php/?option=com_user&view=login
I do not understand this difference on the result.
Any ideas?
Thank you all!