What To Do When Your Disqus Comments Link To The Wrong URL

Let's fix this problem!

Disqus showing wrong comments Working offline helps you avoid screwing up your production site if something goes wrong. I discovered this workflow doesn’t guarantee there will be no problems to your live site in regards to using the Disqus commenting system.

I got some complaints recently from people who clicked on my Disqus comments links after I posted notifications from my blog posts via Disqus to Facebook and Twitter. People alerted me to the fact that the linkback URLs were wrong. When they clicked on my Disqus links, instead of linking to the blog posts they were being served 404 pages because my links started with "http://localhost". How did this happen? I discovered the reason this was happening is because Disqus uses and stores the very first URL for it's links when you post a new article in Joomla. So if you are creating your articles and blog posts in your localmachine version of your website then your links are all going to start with "http://localmachine". What do you do when this happens?

The fix for this was found in a Disqus help article

I discovered the solution in a help article at Disqus. Disqus has a tool accessible in the admin area of  your account that is used for migrating your comments. The migration tool is primarily used when you need to migrate your website and all it's Disqus comments to another server or domain. This tool can also be used when you need to correct or remap your URLs as in the case here where the "http://localhost" needs to be "http://yourdomain.com".

When you need to change the URL in your comments you use the Disqus migration tool

The first step in the process is to go to your Disqus Admin, click Tools and find the Migrate Threads tab. Here's what that screen looks like:

Migrate threads tools

Not all my URLs were wrong on my site, just the last few articles. Using this tool would be a good opportunity to check all of the Disqus links to ensure there are not problems that I wasn't aware of. The migration tool presents you with three options. The first option on the page is a domain migration wizard. I'm not moving to a new domain so this one didn't apply to my situation. I selected the second option, which is to upload a URL map in order to change the link paths. The first part of the URL path, “http://localhost” is what needs to be changed. This option gives you a way to map the correct URLs for your Disqus comment links.

You start by downloading a CSV file of your current comment links

You start by clicking “Start URL mapper”. A new page comes up called “Migrate Threads”. On that page there is a link to have Disqus generate a a CSV (comma-separated values) list of the URLs on your website. Once you click that link, a page comes up telling you that Disqus will send you an email when it has generated the CSV file and provide you with a download link to retrieve it.

Download a CSV

When you retrieve the CSV file you can open it up in MS Excel to inspect it. The links to your Disqus comments will be listed in one column with the full URL path associated with them. It was really easy for me to find the comments that had the wrong link associated with them. Now you are able modify this CSV file with corrected URL paths and upload them to Disqus.

Put the corrected URL in a column beside the ones you need to change

Now you can to edit the file that you downloaded from Disqus. In the first column are all the URLs for your website's Disqus comments including the incorrect ones. Type your corrected URLs in the column next to the incorrect one. This is the format that Disqus needs for your upload with the migration tool:

http://example.com/wrong-path/article.html, http://example.com/corrected-path/article.html

Excel file

Don’t just provide the corrected URLs, be sure that you include all the URLs for the site. If the URL in the left column is correct simply copy it to the column beside it. Change the URLs for the ones that need to be corrected and put those beside the incorrect ones. You will have two columns in your Excel file that will be uploaded to Disqus.

Upload your corrected CSV file to Disqus

Now you are ready to upload a new URL mapping to Disqus. Click the "choose file" button and navigate to your corrected file on your computer. Select it and submit it. The next screen that you will see shows you a sample of the before and after URLs that your Disqus comments will be changed to.

Submit migration

Once you submit the new mappings Disqus will process and remap to the corrected URLs. You'll get a screen that comes up with "Migration Confirmed" message. It takes a little while for Disqus to process the changes but very soon your links will all be correct.

Now there should be no more complaints from your Twitter and Facebook friends that the links are wrong.