latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Root vs subdirectory path in API Logs

Home Forums Community Forum Root vs subdirectory path in API Logs

This topic contains 8 replies, has 2 voices. Last updated by  Jeff Starr 3 years, 7 months ago.

Topic Author Topic
Posted: Tuesday May 14th, 2013 at 5:29 am #49934
Jeff Starr
Username: JeffStarr

Hi guys, just a quick question about some variation I’m seeing in my API logs (e.g., s2-http-api-debug.log).

I have WP installed in a subdirectory named “wp”, and in the s2 logs I’m seeing both of these URLs:

'url' => 'http://example.com/wp/?s2member_paypal_notify=1',

and this (just below the “LOG ENTRY” data):

example.com/?s2member_paypal_notify=1

In the first case, the subdirectory is included in the path, whereas in the second case it is not.

So my question is twofold: is this normal, and if so why?

Or, if it’s not normal, how to resolve the discrepancy?

Thank you as always for your help!

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Thursday May 16th, 2013 at 4:05 am #50064
Bruce
Username: Bruce
Staff Member

Thank you for your inquiry.

I believe the issue you’re coming up with here may have to do with your WordPress site URL that you have set up in your general WordPress settings. What do you have set up under Settings -> General for your Site URL?

Posted: Thursday May 16th, 2013 at 3:06 pm #50084
Jeff Starr
Username: JeffStarr

For “WordPress Address (URL)”, I have this:

http://example.com/wp

And for the “Site Address (URL)”, I have this:

http://example.com

Is this why I am seeing the two different URLs in s2 logs? AND more importantly, is it normal and/or OK for s2member? Usually such discrepancies indicate or lead to issues. Just want to make sure nothing needs changed before going live with the site.

Thanks for your help.

Posted: Tuesday May 21st, 2013 at 3:58 am #50250
Bruce
Username: Bruce
Staff Member

Sorry for the delay in response.

And for the “Site Address (URL)”, I have this:

http://example.com

This is the issue. You should have this the same as your Website URL, with your /wp/ appending the URL. s2Member uses this value to decide where it should send data.

Posted: Tuesday May 21st, 2013 at 4:41 am #50263
Jeff Starr
Username: JeffStarr

Thanks for the response.

So based on what you are saying, installing WP in a subdirectory and then setting the “WordPress Address (URL)” to serve WP from the root directory (i.e., example.com) is an issue? Can you elaborate?

I find that surprising because such configuration is very common among WP sites.

It’s also surprising because there are no errors and s2member is working fine on several sites where WP is installed in a subdirectory (example.com/wp) and served via root (example.com).

But if that is the case, is there a workaround or way to resolve whatever issue you’re referring to? Otherwise, it sounds like s2member isn’t suitable for subdirectory installations of WP, which of course would mean a LOT of customers would be effected.

Thank you again for your help.

Posted: Tuesday May 21st, 2013 at 4:47 am #50264
Bruce
Username: Bruce
Staff Member

It’s also surprising because there are no errors and s2member is working fine on several sites where WP is installed in a subdirectory (example.com/wp) and served via root (example.com).

I’m confused about what you’re saying is going on here. Is your site on a domain, or in a subdirectory? It sounds to me like you’re using a mixture of both the way you’re saying here. s2Member is perfectly capable of running in a subdirectory where your site’s homepage would be at http://example.com/wp/. Where a problem runs into is where your site is actually located at http://example.com/wp/, but you have your site’s URL set to http://example.com/, where s2Member attempts to connect to your site by grabbing the Site’s URL, and is sent to something like http://example.com/wp-login.php when it should be sent to http://example.com/wp/wp-login.php. Does that make sense?

Posted: Tuesday May 21st, 2013 at 5:15 am #50276
Jeff Starr
Username: JeffStarr

Yes I understand what you are saying, thanks for taking the time to help us understand.

Where a problem runs into is where your site is actually located at http://example.com/wp/, but you have your site’s URL set to http://example.com/,

Is this explained to potential s2 customers somewhere? (I haven’t seen it) As mentioned, a LOT of s2 customers will need to know about this issue, as the subdirectory/root configuration (as described) is very common. I’m glad to post and tweet about this if it will help get the word out.

…where s2Member attempts to connect to your site by grabbing the Site’s URL, and is sent to something like http://example.com/wp-login.php when it should be sent to http://example.com/wp/wp-login.php.

I use .htaccess to redirect all requests for wp-login.php to the correct file (which may explain why s2 seems to work fine); so which additional URLs is s2member looking for that could be redirected to the actual file? If there are only a few, perhaps this could be a simple workaround for people who are in this situation.

Posted: Tuesday May 21st, 2013 at 5:23 am #50278
Bruce
Username: Bruce
Staff Member

I use .htaccess to redirect all requests for wp-login.php to the correct file (which may explain why s2 seems to work fine); so which additional URLs is s2member looking for that could be redirected to the actual file? If there are only a few, perhaps this could be a simple workaround for people who are in this situation.

If you’re using a .htaccess rule for this then there shouldn’t really be any issues here if you’ve done it right. Based on your explanation thus far, this is true for you.

However, I have seen sites that methods that go through an index.php file and can cause errors with 404s when this happens. This is not as common as your method, but can screw things up. The only time this will cause a problem with s2Member is if the redirect from the main domain to the actual site on the subdirectory is being done without careful attention to the URI.

My general rule of thumb on this is that if you can reach http://example.com/wp/wp-login.php from http://example.com/wp-login.php, you shouldn’t have any problems. If your site conforms to this rule, then the only consequence to your setup will be that you’ll get weird variations of your URLs in log files.

Posted: Tuesday May 21st, 2013 at 3:06 pm #50303
Jeff Starr
Username: JeffStarr

Thank you Bruce, that is very informative and helpful. It sounds like everything will be okay and that the URL variations in the log files aren’t an indication of an issue in and of themselves. I’ll continue forward while keeping a close eye on things. Thanks again.

Viewing 8 replies - 1 through 8 (of 8 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.