.htaccess -- can it solve my issues?
Posted: Fri Feb 20, 2009 8:16 am
I have the following .htaccess:
I have no idea what it does as I have just recently joined this project, but it seems to enforce SSL when the sub-domain 'members' is accessed? I need to remove that as SSL is not really required anywhere except at login.
Anyways, my real quesiton is this:
I have a directory structure like so:
The files in 'members' are PHP scripts which essentially pull on the contents of the originals inside docroot.
Personally I would have just made each a Linux soft link to the originals. This is obviously so that once a user enters the members.domain.com section of the site they can still access the files in the root. Why they cannot just directly access the root files is beyond me and when I have tried to hardcode the paths so the *real* file is invoked the scripts puke all over me.
I'm shooting for a re-write but in the time being I would like to remove all those extraneous files and have the .htaccess file above include the required conditional to essentially pull on the original much like what the individual files are doing.
Maybe even using an index.php as a proxy to pull the contents of the original file into members.domain.com scope, but I wonder if it's possible to do it with just .htaccess???
Any ideas? Should I just a proxy? Problem with proxy is that I cannot do a file_get_contents() as the files are scripts which need to be evaluated so an include would be required...which might actually work.
Unless there is a way to do it in .htaccess alone so that a request to say:
Would map (*not redirect*) to:
Cheers,
Alex
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !^members\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} ^/members.domain.com($|/.*$)
RewriteRule ^.* https://members.domain.com%1 [R=permanent,L]
php_value session.cookie_domain ".domain.com"
#Redirect C:/wamp/www/members.domain.com http://members.domain.com/Anyways, my real quesiton is this:
I have a directory structure like so:
Code: Select all
www/index.php
www/about.php
www/news.php
www/history.php
[b]www/members/index.php
www/members/about.php
www/members/news.php
www/members/history.php[/b]Personally I would have just made each a Linux soft link to the originals. This is obviously so that once a user enters the members.domain.com section of the site they can still access the files in the root. Why they cannot just directly access the root files is beyond me and when I have tried to hardcode the paths so the *real* file is invoked the scripts puke all over me.
I'm shooting for a re-write but in the time being I would like to remove all those extraneous files and have the .htaccess file above include the required conditional to essentially pull on the original much like what the individual files are doing.
Maybe even using an index.php as a proxy to pull the contents of the original file into members.domain.com scope, but I wonder if it's possible to do it with just .htaccess???
Any ideas? Should I just a proxy? Problem with proxy is that I cannot do a file_get_contents() as the files are scripts which need to be evaluated so an include would be required...which might actually work.
Unless there is a way to do it in .htaccess alone so that a request to say:
Code: Select all
http://members.domain.com/about_us.phpCode: Select all
http://www.domain.com/about_us.phpAlex