I’ve encountered a problem with using a subdomain that I didn’t anticipate. I just setup a new subdomain that looks something like this: client1.mycompany.com
The way godaddy works is the subdomain points to an actual directory on your main website, so in this case I have the subdomain I just mentioned pointing to mycompany.com/clients/client1. What I didn’t anticipate was if someone actually went to the directory where the files are stored instead of going to the subdomain.
When that happens Perch considers that a new page visit and wants to setup new content. I can see this going bad very quickly. Is there anyway I can lock out access to the subdirectories without affecting the subdomain?
I just tried password protecting the subdirectory, but when I do that it negatively affects the easiness of the Perch Administration system by requiring the user to enter yet another password.
Not a viable option IMHO. I’ll need to rethink all of this. Perhaps something as simple as a cryptic, hard to guess, directory name would work.
I’d be inclined to add an .htaccess rule that redirects users who try and load the directory back to the main sub domain. This rewrite rule should get you started;
Regards,
Tim.
On 5 Jul 2012, at 23:24, RavenManiac wrote:
The way godaddy works is the subdomain points to an actual directory on your main website, so in this case I have the subdomain I just mentioned pointing to mycompany.com/clients/client1. What I didn’t anticipate was if someone actually went to the directory where the files are stored instead of going to the subdomain.
I take it that adding an .htaccess rule would not hurt my ability to upload files to that subdirectory. How would I implant something like you’re suggesting?
First, use Transmit or another (S)FTP application to look inside the server folder. Make sure that “Show hidden files” is on in the preferences or menu options (varies by FTP app). You may already have an .htaccess file in the main directory to run the Perch “friendly” URL scheme, so you want to modify the existing .htaccess file, not remove it or overwrite it. Put the redirect rule very near the top of the .htaccess file, so it runs before the Perch redirect.
If your .htaccess file already contains the line RewriteEngine on, don’t duplicate that. Move the following two lines underneath that line:
Replace all three instances of subdomain with your desired subdomain, and both instances of yourdomain with your domain.
Walter
On Jul 5, 2012, at 7:11 PM, RavenManiac wrote:
That’s a great idea Tim.
I take it that adding an .htaccess rule would not hurt my ability to upload files to that subdirectory. How would I implant something like you’re suggesting?
Place it in the root. The rules cascade down to all sub-folders.
In my example code, the word subdomain should be replaced with client1 in all three locations where it appears. The word yourdomain would be replaced with your actual domain name in both places where it appears.
Walter
On Jul 5, 2012, at 7:51 PM, RavenManiac wrote:
Also, I didn’t notice any .htaccess file in either the root or subdirectory. When I’ve priorly prepared that file, where do I place it?
Oh, wait. Don’t put it in the root, put it in the subfolder where your subdomain files live.
Walter
On Jul 6, 2012, at 8:06 AM, Walter Lee Davis wrote:
Place it in the root. The rules cascade down to all sub-folders.
In my example code, the word subdomain should be replaced with client1 in all three locations where it appears. The word yourdomain would be replaced with your actual domain name in both places where it appears.
Walter
On Jul 5, 2012, at 7:51 PM, RavenManiac wrote:
Also, I didn’t notice any .htaccess file in either the root or subdirectory. When I’ve priorly prepared that file, where do I place it?