- Impact
- 109
Hi all,
Need some help here with htaccess, this is a tad complicated:
1) I have a .htaccess file located in the root directory of http://forums.do/ - This htaccess redirects all subdomains to the folder /instance/ (http://forums.do/instance/).
2) This means the virtual root directory of any subdomain is http://forums.do/instance/
3) The above works great. However, accessing http://subdomain.forums.do/instance/ works too... I'm trying to remove that possibility.
4) I have tried using the REQUEST_URI variable to redirect, however when viewing either http://subdomain.forums.do/ or http://subdomain.forums.do/instance/ the REQUEST_URI is the same for both (When you would think accessing through the subdomain's root would NOT produce the '/instance/' in the URI). This leads to an infinite loop. I have tried doing this with the htaccess located at http://forums.do/ AND http://forums.do/instance/
5) PHP can detect the difference just fine, so i currently have any php file located within that folder redirect to the subdomain root.
However i wish to restrict access to the http://subdomain.forums.do/instance/ folder altogether, rather than just the php files located in that folder.
You can see what i mean by visiting http://webmaster.forums.do/test.php and http://webmaster.forums.do/instance/test.php
They both yield the same results, but i want to redirect http://webmaster.forums.do/instance/test.php BACK to http://webmaster.forums.do/test.php
The phpinfo shows the REQUEST_URI as 'test.php' when viewing http://webmaster.forums.do/test.php however viewing http://webmaster.forums.do/instance/test.php shows REQUEST_URI as '/instance/test.php' - This would mean i can use REQUEST_URI within htaccess, however - This is NOT the case with htaccess, both URL's produce the same URI, this is my problem, i cannot rely on REQUEST_URI when trying to redirect traffic from http://subdomain.forums.do/instance/.
I tried to word this as best i could, i hope you can understand what's going on here.
Rhett.
Need some help here with htaccess, this is a tad complicated:
1) I have a .htaccess file located in the root directory of http://forums.do/ - This htaccess redirects all subdomains to the folder /instance/ (http://forums.do/instance/).
2) This means the virtual root directory of any subdomain is http://forums.do/instance/
3) The above works great. However, accessing http://subdomain.forums.do/instance/ works too... I'm trying to remove that possibility.
4) I have tried using the REQUEST_URI variable to redirect, however when viewing either http://subdomain.forums.do/ or http://subdomain.forums.do/instance/ the REQUEST_URI is the same for both (When you would think accessing through the subdomain's root would NOT produce the '/instance/' in the URI). This leads to an infinite loop. I have tried doing this with the htaccess located at http://forums.do/ AND http://forums.do/instance/
5) PHP can detect the difference just fine, so i currently have any php file located within that folder redirect to the subdomain root.
However i wish to restrict access to the http://subdomain.forums.do/instance/ folder altogether, rather than just the php files located in that folder.
You can see what i mean by visiting http://webmaster.forums.do/test.php and http://webmaster.forums.do/instance/test.php
They both yield the same results, but i want to redirect http://webmaster.forums.do/instance/test.php BACK to http://webmaster.forums.do/test.php
The phpinfo shows the REQUEST_URI as 'test.php' when viewing http://webmaster.forums.do/test.php however viewing http://webmaster.forums.do/instance/test.php shows REQUEST_URI as '/instance/test.php' - This would mean i can use REQUEST_URI within htaccess, however - This is NOT the case with htaccess, both URL's produce the same URI, this is my problem, i cannot rely on REQUEST_URI when trying to redirect traffic from http://subdomain.forums.do/instance/.
I tried to word this as best i could, i hope you can understand what's going on here.
Rhett.
Last edited: