[Pro] Perch subdomain problem?

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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.

Any suggestions are welcome. :slight_smile:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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.


FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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:

RewriteCond %{HTTP_HOST}       !subdomain.yourdomain.com$
RewriteRule [subdomain]?(.*) http://subdomain.yourdomain.com/$1 [R=301,L]

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walter. I’ll give it a shot.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walter, I’m not sure i’m following you on what I need to do here. Is my subdomain name client1.mycompany.com or simply client1?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Gotcha. Thanks Walter.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options