Event Calendar
[resolved] Not loading events when accessing via WWW subdomain (2 posts)

  1. danzigism
    Posted 4 years ago #

    Hello there. I seem to be experiencing a core issue with this plugin and I'm not quite sure how to resolve it.

    I have the calendar being displayed on a regular page with a compatible theme.

    If I go to: http://domain.com/calendar it works just fine because I have domain.com as my WordPress Site URL.

    If I go to http://www.domain.com/calendar it does not work because it doesn't match the exact Site URL in wordpress. Here's the error I'm receiving when I do a little debugging.

    XMLHttpRequest cannot load http://domain.com/wp-admin/admin-ajax.php. Origin http://www.domain.com is not allowed by Access-Control-Allow-Origin.

    It appears to be an actual AJAX issue. Why doesn't allow for simple wildcards to be able to utilize the "Access Control Allow Origin" ?

    If I change the site URL in the WP options to http://www.domain.com it works like a champ. But both domain.com and http://www.domain.com do not work at the same time.

    Thanks for your time.


  2. danzigism
    Posted 4 years ago #

    Fixed my issue. I had to modify my website's .htaccess file to redirect the requests sent to domain.com to go to http://www.domain.com. It is essential to not have duplicate sites. To redirect domain.com to http://WWW.domain.com, add the following to your .htaccess file:

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic