Topic-icon JLinked throws a JS error

Active Subscriptions:

None
12 years 1 month ago #20334 by jerjaz
Hey Alex

Is it possible to amend the URL list for my site to include both www and non-www URLs?

I discovered this as I am trying to find out why my GeoTrust badge won't resolve on my non-www url.
Error reads:

JavaScript API Domain is restricted to writingpractice.com
[Break On This Error]

throw new Error("JavaScript API Domain is restricted to "+h.join(", "));

usersp...ph3qbd& (line 40)
The topic has been locked.
Support Specialist
12 years 1 month ago #20344 by alzander
Replied by alzander on topic JLinked throws a JS error
No, there's no way to do that within LinkedIn. They only work on a specific URL domain (www.site.com OR site.com, but not both). What we'd recommend is setting up an .htaccess rule to redirect traffic from one variant to the other. It will fix this problem and is also better for search engine rankings and a lot of other things that will see 'duplicate content'. The rule to add looks like the below:
RewriteCond %{HTTP_HOST} !^www.site.com [nc]
RewriteRule ^(.*) http://www.site.com/$1 [r=301,NC,L]
That should be after the command "Rewrite Engine On", which should already be in your .htaccess file. The rule above will always force the www version, you can simply remove www from both lines to get it to go the other way.

If you already are using a .htaccess file on your site, it's pretty simple.. if not, let us know, and we can help as necessary.

Hope that helps, and let us know how it goes!
Alex
The topic has been locked.