{"id":624,"date":"2014-10-05T21:14:15","date_gmt":"2014-10-05T15:44:15","guid":{"rendered":"http:\/\/abhinav.spsdarj.org\/?p=624"},"modified":"2016-03-06T12:19:20","modified_gmt":"2016-03-06T06:49:20","slug":"guide-to-setting-up-mediawiki-on-hostgator","status":"publish","type":"post","link":"https:\/\/abhinavkr.com\/musings\/2014\/10\/guide-to-setting-up-mediawiki-on-hostgator\/","title":{"rendered":"Guide to setting up mediawiki on Hostgator"},"content":{"rendered":"<p>It isn&#8217;t all that easy to create a good mediawiki site with URL rewrite (you know&#8230; hide the &#8220;<em>index.php<\/em>&#8221; part and make it all pretty looking like &#8220;<em>YourDomain.ext<\/em><em>\/wiki\/<\/em>&#8220;), So here I put down a step by step method of going through this cumbersome process.<\/p>\n<ol>\n<li>QuickInstall mediawiki in a directory in your public_html folder. Say, in folder &#8220;<em>wiki<\/em>&#8220;. (Now, your mediawiki installation is in &#8220;<em>YourDomain.ext\/wiki\/<\/em>&#8221; but yet, when you go to <em>YourDomain.ext<\/em>, you aren&#8217;t redirected to anywhere (like going to <a href=\"http:\/\/en.wikipedia.org\">en.wikipedia.org<\/a> redirects you to <em>en.wikipedia.org\/wiki\/<\/em>). So now,<\/li>\n<li>Add this to the <em>.htaccess<\/em> file in <em>public_html<\/em> to redirect your root folder link to the subfolder in which wiki is installed. (So now, when you enter <em>YourDomain.ext<\/em>, it takes you to <em>YourDomain.ext\/wiki<\/em>)\n<pre>RewriteEngine On\r\nRewriteCond %{HTTP_HOST} ^(www.)?YourDomain.ext$\r\nRewriteRule ^(\/)?$ wiki [L]<\/pre>\n<p>The only change you need to make is to change \u201c<em>YourDomain.ext<\/em>\u201d to your domain and its extension. This will then redirect everything from the domain to the folder <em>\/wiki<\/em> at that domain. If you want to change that folder just edit the \u201c<em>wiki<\/em>\u201d part.<\/li>\n<li>Now, I&#8217;ll give you a general explanation of how this next step works.\u00a0Add this to the .<em>htaccess<\/em> in <em>public_html\u00a0<\/em>following what you&#8217;ve already entered before.\n<pre>RewriteBase \/music\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^wiki\/(.*)$ .\/wiki\/index.php?title=$1 [PT,L,QSA]<\/pre>\n<p>&#8216;<strong>RewriteBase<\/strong>&#8216; defines where the rewrite will start. The example above will match after &#8216;<em>YourDomain.ext\/music<\/em>&#8216;. If you leave it at just a &#8220;\/&#8221; (i.e. <em>YourDomain.ext\/)<\/em>, then rewrite starts after the <em>.ext<\/em> itself. That&#8217;s what you probably want. Remove the &#8220;<em>music<\/em>&#8220;<em>\u00a0<\/em>from the code above.<br \/>\n&#8216;<strong>RewriteCond<\/strong>&#8216; makes sure that links to files (like stylesheets or images) are not rewritten, which can break MediaWiki&#8217;s formatting in some cases.<br \/>\n&#8216;<strong>RewriteRule<\/strong>&#8216; defines the rewrite. In the example above, &#8216;<em>^wiki\/(.*)<\/em>&#8216; will invisibly load &#8216;<em>wiki\/index.php?title=$1<\/em>&#8216;, and\u00a0the page name (&#8216;<em>$1<\/em>&#8216;) will replace everything after &#8216;<em>wiki\/<\/em>&#8216;\u00a0.<\/li>\n<li>Add or edit the following setting in <em>LocalSettings.php<\/em>. This causes the HTML generated by MediaWiki to refer to &#8220;<em>\/wiki\/Articlename<\/em>&#8221; instead of the default.<br \/>\n<code>$wgScriptPath = \"\/music\/wiki\"; <span style=\"color: #ff6600;\">#based on requirement, you can keep it as $wgScriptPath = \"\/wiki\";<\/span><br \/>\n$wgArticlePath = \"$wgScriptPath\/$1\";<\/code><\/li>\n<\/ol>\n<h3>Conclusion:<\/h3>\n<p>So, At the end of working on all of this, summary goes:<\/p>\n<h5>Goes into public_html\u00a0<em>.htaccess<\/em><\/h5>\n<pre>RewriteEngine On\r\nRewriteCond %{HTTP_HOST} ^(www.)?YourDomain.ext$\r\nRewriteRule ^(\/)?$ wiki [L]\r\n\r\nRewriteBase \/\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^wiki\/(.*)$ .\/wiki\/index.php?title=$1 [PT,L,QSA]<\/pre>\n<h5>Goes to <em>localsetting<\/em><\/h5>\n<pre>$wgScriptPath = \"\/wiki\";\r\n$wgArticlePath = \"$wgScriptPath\/$1\";<\/pre>\n<h6>Disclaimer:<\/h6>\n<p>This article is not associated directly with the creators of mediawiki.<br \/>\nTested on Hostgator servers. Do check out\u00a0<a href=\"https:\/\/www.mediawiki.org\/wiki\/Manual:Short_URL\">Mediawiki&#8217;s manual on Short URLs<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It isn&#8217;t all that easy to create a good mediawiki site with URL rewrite (you know&#8230; hide the &#8220;index.php&#8221; part and make it all pretty looking like &#8220;YourDomain.ext\/wiki\/&#8220;), So here I put down a step by step method of going through this cumbersome process. QuickInstall mediawiki in a directory in your public_html folder. Say, in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":625,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[189],"tags":[],"class_list":["post-624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/abhinavkr.com\/musings\/wp-content\/uploads\/2014\/10\/poweredby_mediawiki_88x31.png?fit=88%2C31&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p4KGvB-a4","jetpack-related-posts":[{"id":1419,"url":"https:\/\/abhinavkr.com\/musings\/2017\/12\/how-to-redirect-base-url-addresses-to-another-base-url\/","url_meta":{"origin":624,"position":0},"title":"How to redirect base url addresses to another base URL","author":"Abhinav","date":"December 11, 2017","format":false,"excerpt":"Say you have\u00a0http:\/\/abhinav.spsdarj.org\/2017\/12\/how-to-redirect-base-url-addresses-to-another-base-url\/ as a url on your old website (abhinav.spsdarj.org) and now you want the link to redirect to new website. Say\u00a0abhinav.ga\u00a0but the url following abhinav.ga should stay the same and when typing the old url, should magically redirect with rest of the link intact to the new website.\u2026","rel":"","context":"In &quot;Tech&quot;","block_context":{"text":"Tech","link":"https:\/\/abhinavkr.com\/musings\/category\/knowledge\/tech\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":837,"url":"https:\/\/abhinavkr.com\/musings\/2015\/08\/dedrick-lai-to-how-can-i-draw-a-3d-picture\/","url_meta":{"origin":624,"position":1},"title":"Dedrick Lai to How can I draw a 3D picture?","author":"Abhinav","date":"August 31, 2015","format":false,"excerpt":"I tell you how I draw a simple 3D picture step by step. I mean a two dimensional representation of three dimensional objects. 1.Prepare the tools I need. 2.Draw the basic pattern, for example,the date \"10.31\". 3.Color the light red. 4.Choose a direction that I see this paper. This is\u2026","rel":"","context":"In &quot;Fun Stuff&quot;","block_context":{"text":"Fun Stuff","link":"https:\/\/abhinavkr.com\/musings\/category\/fun-stuff\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":730,"url":"https:\/\/abhinavkr.com\/musings\/2015\/03\/what-does-it-feel-like-to-be-old\/","url_meta":{"origin":624,"position":2},"title":"What does it feel like to be old?","author":"Abhinav","date":"March 8, 2015","format":false,"excerpt":"I am the same age as Sean Connery and Clint Eastwood. In Dog-years that is really really ancient. I am shorter than either, but heavier than both. I am not sure if that makes up for it. I was once the captain of the school basketball team. But it was\u2026","rel":"","context":"In &quot;Quora Post&quot;","block_context":{"text":"Quora Post","link":"https:\/\/abhinavkr.com\/musings\/category\/quora-post\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":845,"url":"https:\/\/abhinavkr.com\/musings\/2015\/10\/what-are-the-secrets-of-being-likable\/","url_meta":{"origin":624,"position":3},"title":"What are the secrets of being likable?","author":"Abhinav","date":"October 2, 2015","format":false,"excerpt":"Answer by Anatole Ginsberg:When I was young I thought the secret to popularity was to be as impressive as possible so people would want to talk to me.Instead they thought I was arrogant.Then I examined what made me want to befriend someone, and I learned that I'd had it all\u2026","rel":"","context":"In &quot;Life stuff&quot;","block_context":{"text":"Life stuff","link":"https:\/\/abhinavkr.com\/musings\/category\/life-stuff\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":462,"url":"https:\/\/abhinavkr.com\/musings\/2019\/11\/types-of-fever\/","url_meta":{"origin":624,"position":4},"title":"Types of fever","author":"MindBodyBlog","date":"November 29, 2019","format":false,"excerpt":"Types of fever is a frequently asked viva question but a concise and complete answer is not available for it anywhere. I've tried to come up with a complete list which I have gotten verified by a Medicine SR and partly by a prof. However, if any errors are found,\u2026","rel":"","context":"In &quot;Medical Stuff&quot;","block_context":{"text":"Medical Stuff","link":"https:\/\/abhinavkr.com\/musings\/category\/medical-stuff\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/abhinavkr.com\/musings\/wp-content\/uploads\/2019\/11\/1024px-Clinical_thermometer_38.7.jpg?fit=1024%2C634&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/abhinavkr.com\/musings\/wp-content\/uploads\/2019\/11\/1024px-Clinical_thermometer_38.7.jpg?fit=1024%2C634&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/abhinavkr.com\/musings\/wp-content\/uploads\/2019\/11\/1024px-Clinical_thermometer_38.7.jpg?fit=1024%2C634&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/abhinavkr.com\/musings\/wp-content\/uploads\/2019\/11\/1024px-Clinical_thermometer_38.7.jpg?fit=1024%2C634&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":734,"url":"https:\/\/abhinavkr.com\/musings\/2015\/03\/what-are-the-most-difficult-and-useful-things-people-have-to-learn-in-their-20s\/","url_meta":{"origin":624,"position":5},"title":"What are the most difficult and useful things people have to learn in their 20s?","author":"Abhinav","date":"March 13, 2015","format":false,"excerpt":"Answer by Anonymous:45 Life Lessons Written by a 90-year-old 1. Life isn\u2019t fair, but it\u2019s still good. 2. When in doubt, just take the next small step. 3. Life is too short not to enjoy it. 4. Your job won\u2019t take care of you when you are sick. Your friends\u2026","rel":"","context":"In &quot;Quora Post&quot;","block_context":{"text":"Quora Post","link":"https:\/\/abhinavkr.com\/musings\/category\/quora-post\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/comments?post=624"}],"version-history":[{"count":3,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/624\/revisions"}],"predecessor-version":[{"id":898,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/posts\/624\/revisions\/898"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/media\/625"}],"wp:attachment":[{"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/media?parent=624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/categories?post=624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abhinavkr.com\/musings\/wp-json\/wp\/v2\/tags?post=624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}