Our website url is ending with slash "/", it get encoded to "%2F". because of this slash facebook like button is not showing on the website.
Eg
Not working url: because in href parameter url has "%2F", but if i remove the "%2f", it starts working. Earlier it was working fine.
https://www.facebook.com/plugins/like.php?action=like&channel_url=https%3A%2F%2Fs-static.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D9%23cb%3Df3e1268db4%26origin%3Dhttps%253A%252F%252Fwww.bcgperspectives.com%252Ff189b4c84c%26domain%3Dwww.bcgperspectives.com%26relation%3Dparent.parent&extended_social_context=false&font=arial&href=https%3A%2F%2Fwww.bcgperspectives.com%2Fcontent%2Fvideos%2Fleadership_paul_deighton_organizing_london_2012_olympics%2F&layout=button_count&locale=en_US&node_type=link&ref=.UCfPf5lBPRI.like&sdk=joey&show_faces=false&width=90
any solution for it.
I can’t get a like button shown on https://developers.facebook.com/docs/reference/plugins/like/ when I input your URL https://www.bcgperspectives.com/content/videos/leadership_paul_deighton_organizing_london_2012_olympics/, no matter whether the trailing slash is there or not.
However, it does get shown if I use http:// instead of https:// in front of your URL – then it works for both versions, the one with the trailing slash and the one without.
An interesting fact though is, that I can not see any information scraped from your page using the debug tool on your URL – doesn’t matter if its the slash or no-slash version or the HTTP vs the HTTPS version, since your server redirects to the HTTPS version with the trailing slash anyway. So that might point to some problem FB’s scraper has with your URL/domain (although no explicit error messages are shown).
Related
I migrated a clients site from a Movable Type site with posts that ended in ".php" to a WordPress site that ends in a slash "/". All my 301 redirects are working great but i found out from the client he has links in his websites Facebook page. Those links end in ".php?fbclid=InsertRandomParamsHere". What I need to do is replace the ".php" with "/" and the pages will redirect correctly while maintaining the Facebook tracking parameters at the end.
I've been using a regular expression for the 301 and here is what my regex looks like so far (I'm using Rank Math plugin for redirects):
The Source URL regex is:
^(.*)\.php(.*)
The Destination URL is:
https://www.beachwoodreporter.com/
What I get right now is, for an example link:
http://www.beachwoodreporter.com/music/you_turn_me_on_again.php?fbclid=IwAR37SDAQdPrxMqwHQEY6dcs5rle1Mt0b0WubR9dL8WbaX3zoKNqjW0J84p0
which should redirect to:
http://www.beachwoodreporter.com/music/you_turn_me_on_again/?fbclid=IwAR37SDAQdPrxMqwHQEY6dcs5rle1Mt0b0WubR9dL8WbaX3zoKNqjW0J84p0
is instead redirecting to:
http://www.beachwoodreporter.com/?fbclid=IwAR37SDAQdPrxMqwHQEY6dcs5rle1Mt0b0WubR9dL8WbaX3zoKNqjW0J84p0
so it's basically stripping out the slug portion of the URL:
/music/you_turn_me_on_again/
And the client has many links like this on their Facebook site trying to do one at a time is out of the question. All I need is to replace the ".php" with "/" and it should fix all these problems. Can what I want be done or should I tell the client I can't do it?
Image of the Rank Math regex settings:
This Regex finds URLs that begin with http and https
https?:\/\/(www\.)?[-a-zA-Z0-9#:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9#:%_\+.~#?&//=]*)
I am trying to figure out how to modify this to including those URLs which omit the http or https part. I understand that these are called 'Protocol-relative URLs'
example: //example.com and not http://example.com
Simply make the protocol part optional:
(https?:)?(\/\/)?(www\.)?[-a-zA-Z0-9#:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9#:%_\+.~#?&//=]*)
By the way I assume you really wanted example.com and not //example.com (since no one writes a URL that way).
I have my Django app. I have a redirect URL(say a 404 page) to be redirected when no other URL matches. Now if any url is called as
mysite.com/something
I am redirected to the 404 page. But
mysite/something/
works fine.
The redirection url added to the end of all:
url(r'^.*/',theview),
When I remove the redirect url from the urls.py, the problem is cleared and the above URL works (without / at the end). Why is the error?
First of all, it would be a good idea to link to your previous post and mention you are using a hack that I gave you, because (A) it's not normal setup and (B) Someone might come up with a better idea than mine
Secondly, you're seeing this behaviour because of normal url processing. See, the urls mysite.com/something and mysite.com/something/ are not the same. To match it with django's urls, the difference would be:
url(r'^something/$')
url(r'^something$')
Since the difference is so minor, when using a normal setup, after failing to find the a url without a forward slash django's common middlewere* will automatically try to add one and test it. It's only then that it would give up and forward you to a 404 page.
However, in your setup, the catch-all url prevents the second round because it does apply to the url without the forward slash. My solution? Don't worry about it. The only reason you're using this hack is because Debug=True means a debug page instead of your custom 404 page, a problem you won't be facing when moving to a production environment
*and a big thanks to #Alasdair who pointed this out in the comments
I'm trying to do some URL redirects and the redirects are working properly, however if I try to redirect a URL that ends in a forward slash the redirect does not work. For example, I'd like to redirect http://mydomain/foo/ to /bar/ does not work. However http://mydomain/foo to /bar/ does redirect properly. Can anyone tell me how to redirect urls with training forward slashes properly?
I think that if a web server indicates a trailing slash, it immediately looks for the default file (e.g. index.html) in the given directory.
This convention is speeding up the web server work.
e.g.
http://mysite/test/ ==> is a directory
http://mystite/test ==> is a file
I've set the APPEND_SLASHES directive to False in my settings.py file and yet Django carries on to redirect some (but not all) requests which is incredibly annoying. What could be causing this issue?
Basically, if I make a request without the slash, it will return the correct response body, but with a redirect (301), redirecting it to the same URL but with a slash at the end which will not match because it shouldn't end in a slash.
Is there a fix for that or do I just need to strip the slash redirection code from CommonMiddleware?
Edit: CommonMiddleware is not the culprit. The URL reaches it with a slash at the end.
Edit2: Only happens in Firefox. What the hell? Firebug registers two HTTP requests, one of which is a redirect. Only one request actually hits the server, and it's the one with the slash at the end. The 301 appears out of nowhere and isn't even sent (Wireshark doesn't register it).
301 are permament redirects. So if you have had this option set to true before firefox will still remember this permament redirect and go to page with slash appended. Try to clear firefoxes caches and offline contents.