After going through what I’ve done with the SharePoint engineer in my company, I was told the issue is with WikiRedirect.aspx. I was told this page doesn’t exist on my SharePoint 2010 Enterprise Wiki site. So to work around the issue, I had to update Stefan’s JavaScript and made it work in SharePoint 2010. The UI looks a bit different than what WikiRedirect.aspx does, but essentially the same. The script redirects to a page if it already exists, or prompt to create a new page if it doesn’t exist.

When you use this script, please update the SiteUrl variable to represent the URL of your SharePoint wiki site.

Please note adding scripts to a web part is different in SharePoint 2010 than 2013. The script needs to be uploaded to the site as a separate file then link the the web part. here’s a good article on how to do it.

Note: I have also tested this script on my SharePoint 2013 wiki site. Unfortunately, it does NOT work.

Disclaimer:

My knowledge on SharePoint and JavaScript is next to none. Therefore, when I was told wikiredirect.aspx was the problem, I had to take his word for it. And I did lots of search online and came up with this JavaScript that worked for me. I won’t get offended if someone criticise me if my statement is wrong about SharePoint and if you think the script can be improved. Lastly, please test it and make sure it works in your environment. I don’t have another SharePoint 2010 site I can test on, the only place I made it work is on my work’s production SharePoint site.