I know nothing about programming or running a server, but I’ve had my server for about 10 years and over time I’ve added this and that to different code. Below is a code I have used to protect access to a site. Please note that below the SPACE after “http://” isn’t really in my code, I just put it here to prevent a link from showing up
RewriteEngine On
RewriteCond %{HTTP_referer} !^http:// (www.)?MAINSITE\.com/members/ [NC]
RewriteCond %{HTTP_referer} !^http:// (www.)?DAUGHTERSITE\.com/members/ [NC]
RewriteRule .* http:// www.MAINSITE.com/members/term.php?Term=abc1\&Site=daught\ site\&page=members [R=301,L]
What I want to do with this is allow access to DAUGHTERSITE/members from MAINSITE and only from MAINSITE
If someone tries to access DAUGHTERSITE/members from anywhere, they are redirected to http:// www.MAINSITE.com/members/term.php?Term=abc1\&Site=daughter\ site\&page=members which a link is presented to take them to DAUGHTERSITE/members
I thought this worked for a few years, but now I’m noticing that I sometimes get an error. Don’t really know if these errors were there all along, but kind of think so. Much of the time things work as planned, but sometimes when I click the last link to goto DAUGHTERSITE/members I remain on the exact same page without going anywhere–it’ll start to do something like it’s about to load, then I see the same URL of the page I am already on load and I’m on the same page without moving.
This doesn’t happen all the time, but once it does happen, it seems to happen continually for awhile if I use the same browser. I sometimes get different results with another browser or another computer.
I’m wondering if there might be an issue in the code which makes this work much of the time, but other times the server just says…“ummmm, nope, not this time!”
What I’ve tried… I’ve tried adding Options +FollowSymlinks but doesn’t seem to make any difference. I even tried removing the “=301” but that also doesn’t seem to matter.
Using Cpanel. Both sites are mine and on the same server. The htaccess is located at DAUTHERSITE/members/ Any suggestions much appreciated. I wrote this stuff piece by piece over the years from stuff I read and copied parts of, but I now have no clue what any of it does when I look at it.