.htaccess - Pretty URLs aren't working after upgrade to Mediawiki 1.24.2 -


so moving mediawiki site of mine new server. version 1.20.3 worked fine on old server running ubuntu 12.04. however, when copied on new server running ubuntu 14.04 didn't. after messing while decided might easier upgrade 1.20.3 1.24.2 @ same time.

i got 1.24.2. mediawiki download site. unzipped it. ran maintenance/upgrade.php , copied extensions, images, uploads, skins, logos, , localsettings.php files 1.20.3 1.24.2. 1.24.2 site works fine long use http://wikis.controltheorypro.com/index.php?title=main_page not when use http://wikis.controltheorypro.com/main_page or http://wikis.controltheorypro.com/ (which redirects http://wikis.controltheorypro.com/main_page).

the redirects worked fine 1.20.3 on old server. , in localsetting.php or db still telling mediawiki use pretty urls because of urls on main page lacking index.php?title= portion of url.

i'm competent php , server person old site , ever deal when move servers. it's site put lot of effort several years ago. i'd have killed seems lot of traffic students keep alive.

i have attempted several solutions via google , mediawiki site.

my .htaccess mess @ point here is:

#rewriteengine on  #rewritecond %{http_host} ^controltheorypro.com$ [or] #rewritecond %{http_host} ^www.controltheorypro.com$ #rewriterule ^/?$ "http\:\/\/wikis\.controltheorypro\.com" [r=301,l]  <ifmodule mod_rewrite.c> # turn on mod_rewrite rewriteengine on  # virtual path index.php rewriterule ^/?(/.*)?$ %{document_root}/index.php [l] rewritecond %{document_root}%{request_uri} !-f rewritecond %{document_root}%{request_uri} !-d rewriterule ^(.*)$ %{document_root}/index.php [l] rewriterule ^/*$ %{document_root}/index.php [l]  # if converting static site wiki, # you'll want make redirections new article. #rewriterule ^old-file.html$ http://www.example.com/new_article [r=permanent,l]  # hack lets gets rid of redirection # "main page".  conversely, if go http://www.example.com/main_page, # sends permanent external redirection http://www.example.com/. rewriterule ^main_page$ http://wikis.controltheorypro.com/ [r=permanent,l] rewriterule ^$ /var/www/html/ctp/mediawiki-1.24.2/index.php?title=main_page&redirect=no [qsa,l]  rewriterule ^/new/rss http://wikis.controltheorypro.com/index.php?title=special:newpages&feed=rss [qsa,l] rewriterule ^/do/([a-z]*)/(.*)$ /var/www/html/ctp/mediawiki-1.24.2/index.php?action=$1&title=$2 [qsa,l]  # finally, if we've gotten far, process if it's article, # unless it's physical file/directory/symlink. rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l rewriterule ^(.*)$ /var/www/html/ctp/mediawiki-1.24.2/index.php?title=$1 [qsa,l] </ifmodule> 

localsettings.php:

<?php # file automatically generated mediawiki 1.20.3 # installer. if make manual changes, please keep track in case # need recreate them later. # # see includes/defaultsettings.php configurable settings # , default values, don't forget make changes in _this_ # file, not there. # # further documentation configuration settings may found at: # http://www.mediawiki.org/wiki/manual:configuration_settings  # protect against web entry if ( !defined( 'mediawiki' ) ) {         exit; }  ## uncomment disable output compression # $wgdisableoutputcompression = true;  $wgsitename      = "controltheorypro.com";  ## url base path directory containing wiki; ## defaults runtime url paths based off of this. ## more information on customizing urls ## (like /w/index.php/page_title /wiki/page_title) please see: ## http://www.mediawiki.org/wiki/manual:short_url $wgscriptpath       = ""; $wgscriptextension  = ".php";  ## added me enable pretty permalinks $wgarticlepath = "$wgscriptpath/$1"; $wgusepathinfo = true;  ## protocol , server name use in fully-qualified urls $wgserver           = "http://wikis.controltheorypro.com";  ## relative url path skins directory $wgstylepath        = $wgscriptpath . "/skins";  ## relative url path logo.  make sure change default, ## or else you'll overwrite logo when upgrade! $wglogo             = $wgserver . "/logo.gif"; // "/wiki_symbol_default_size.png"; // "$wgstylepath/common/images/wiki.png";  ## upo means: user preference option  $wgenableemail      = true; $wgenableuseremail  = true; # upo  $wgemergencycontact = "admin@controltheorypro.com"; $wgpasswordsender   = "admin@controltheorypro.com";  $wgenotifusertalk      = false; # upo $wgenotifwatchlist     = false; # upo $wgemailauthentication = true;  ## database settings ....  # mysql specific settings $wgdbprefix         = "";  # mysql table options use during installation or update $wgdbtableoptions   = "engine=innodb, default charset=binary";  # experimental charset support mysql 5.0. $wgdbmysql5 = false;  ## shared memory settings $wgmaincachetype    = cache_memcached; $wgmemcachedservers = array( '127.0.0.1:11211' );  ## enable image uploads, make sure 'images' directory ## writable, set true: $wgenableuploads  = true; #$wguseimagemagick = true; #$wgimagemagickconvertcommand = "/usr/bin/convert";  # instantcommons allows wiki use images http://commons.wikimedia.org $wguseinstantcommons  = true;  ## if use imagemagick (or other shell command) on ## linux server, need set name of ## available utf-8 locale $wgshelllocale = "en_us.utf8";  ## if want use image uploads under safe mode, ## create directories images/archive, images/thumb , ## images/temp, , make them writable. uncomment ## this, if it's not uncommented: #$wghasheduploaddirectory = false;  ## set $wgcachedirectory writable directory on web server ## make wiki go faster. directory should not ## publically accessible web. #$wgcachedirectory = "$ip/cache";  # site language code, should 1 of list in ./languages/names.php $wglanguagecode = "en";  $wgsecretkey = ...;  # site upgrade key. must set string (default provided) turn on # web installer while localsettings.php in place $wgupgradekey = ...;  ## default skin: can change default skin. use internal symbolic ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector': $wgdefaultskin = "gumaxdd"; // "vector";  ## attaching licensing metadata pages, , displaying ## appropriate copyright notice / icon. gnu free documentation ## license , creative commons licenses supported far. $wgrightspage = ""; # set title of wiki page describes license/copyright $wgrightsurl  = "http://creativecommons.org/licenses/by-nc-sa/3.0/"; $wgrightstext = "creative commons attribution non-commercial share alike"; $wgrightsicon = "{$wgstylepath}/common/images/cc-by-nc-sa.png";  # path gnu diff3 utility. used conflict resolution. $wgdiff3 = "/usr/bin/diff3";            // manually added - gts 04/11/13  # query string length limit resourceloader. should set if # web server has query string length limit (then set limit), # or if have suhosin.get.max_value_length set in php.ini (then set # value) $wgresourceloadermaxquerylength = -1;  # following permissions set based on choice in installer $wggrouppermissions['*']['edit'] = false;  # enabled extensions. extensions enabled including base extension file here # check specific extension documentation more details # following extensions automatically enabled: require_once( "$ip/extensions/confirmedit/confirmedit.php" ); require_once( "$ip/extensions/gadgets/gadgets.php" ); require_once( "$ip/extensions/math/math.php" ); require_once( "$ip/extensions/nuke/nuke.php" ); require_once( "$ip/extensions/parserfunctions/parserfunctions.php" ); require_once( "$ip/extensions/renameuser/renameuser.php" ); require_once( "$ip/extensions/vector/vector.php" ); require_once( "$ip/extensions/wikieditor/wikieditor.php" );   # end of automatically generated settings. # add more configuration options below.  # action paths - should spam , pretty urls #               these require a rewriterule in .htaccess though see #               http://www.mediawiki.org/wiki/user:fo0bar/mediawiki_root_articles #               details. # #               these did not work @ first because had messed $wgscriptpath #               careful.  /* #$wgarticlepath = "/$1";  foreach($wgactions $action => $value) {   if($value === false) { continue; }   if($action == 'raw') { continue; }   $wgactionpaths[$action] = "$wgscriptpath/do/$action/$1"; } $wgactionpaths['view'] = $wgarticlepath; */  # favicon $wgfavicon = $wgscriptpath . "/favicon.ico";  # don't allow site iframed $wgbreakframes = true; # add rel="no follow" links $wgnofollowlinks = true;                // true default of 04/11/13 in case  # exceptions default rel="no follow" rule $wgnofollowdomainexceptions = array(...  # add equations site - url mathtex in math.body.php (function rendermath) require_once("$ip/extensions/math/math.php");  # add captcha #               config: http://www.mediawiki.org/wiki/extension:confirmedit require_once("$ip/extensions/confirmedit/confirmedit.php"); require_once("$ip/extensions/confirmedit/recaptcha.php"); $wgcaptchaclass = 'recaptcha'; $wgrecaptchapublickey = ...; $wgrecaptchaprivatekey = ...;          # user permissions wrt captcha         $wggrouppermissions['*'            ]['skipcaptcha'] = false;         $wggrouppermissions['user'         ]['skipcaptcha'] = false;         $wggrouppermissions['autoconfirmed']['skipcaptcha'] = false;         $wggrouppermissions['bot'          ]['skipcaptcha'] = true; // registered bots         $wggrouppermissions['sysop'        ]['skipcaptcha'] = true;          # action permission wrt captcha         $wgcaptchatriggers['edit']          = false;            // doesn't show captcha         $wgcaptchatriggers['create']        = true;         $wgcaptchatriggers['addurl']        = true;             // shows captcha         $wgcaptchatriggers['createaccount'] = true;         $wgcaptchatriggers['badlogin']      = true;          # can configured whitelist ips , confirmed emails  # filter out pages/edits/etc include following #               ref & more examples: http://www.mediawiki.org/wiki/manual:$wgspamregex $wgspamregex = "/".                        # "/" opening wrapper                 "s-e-x|zoofilia|sexyongpin|grusskarte|geburtstagskarten|animalsex|".                 "sex-with|dogsex|adultchat|adultlive|camsex|sexcam|livesex|sexchat|".                 "chatsex|onlinesex|adultporn|adultvideo|adultweb.|hardcoresex|hardcoreporn|".                 "teenporn|xxxporn|lesbiansex|livegirl|livenude|livesex|livevideo|camgirl|".                 "spycam|voyeursex|casino-online|online-casino|kontaktlinsen|cheapest-phone|".                 "laser-eye|eye-laser|fuelcellmarket|lasikclinic|cragrats|parishilton|".                 "paris-hilton|paris-tape|2large|fuel-dispenser|fueling-dispenser|huojia|".                 "jinxinghj|telematicsone|telematiksone|a-mortgage|diamondabrasives|".                 "reuterbrook|sex-plugin|sex-zone|lazy-stars|eblja|liuhecai|".                 "viagra|cialis|levitra|".                 "airsoft|estate|facebook|loan|credit|garden|porn|sunless|landscaping|coupons|wartol|xbox|playstation|".                 "buy-viagra|-cialis|-levitra|boy-and-girl-kissing|". # these match spammy words                 "dirare\.com|".           # matches dirare.com spammer's domain name                 "overflow\s*:\s*auto|".   # matches against overflow:auto (regardless of whitespace on either side of colon)                 "height\s*:\s*[0-4]px|".  # matches against height:0px (most css hidden spam) (regardless of whitespace on either side of colon)                 "==<center>\[|".           # matches recent spam related starsearchtool.com , friends                 "\<\s*a\s*href|".         # blocks href links entirely, forcing wiki syntax                 "display\s*:\s*none".     # matches against display:none (regardless of whitespace on either side of colon)                 "/i";                     # "/" ends regular expression , "i" switch follows makes test case-insensitive                                           # "\s" matches whitespace                                           # "*" repeater (zero or more times)                                           # "\s*" means 0 or more amount of whitespace  # attempt eliminate bots require_once( "$ip/extensions/antibot/antibot.php" );  # citations/references require_once("$ip/extensions/cite/cite.php");  # category tree #               config: http://www.mediawiki.org/wiki/extension:categorytree $wguseajax = true; require_once( "$ip/extensions/categorytree/categorytree.php" );  # wiki seo # details: http://www.mediawiki.org/wiki/extension:wikiseo #       example: {{#seo: title=your page title | titlemode= append | keywords=these,are,your,keywords | description=your meta description }} include_once("$ip/extensions/wikiseo/wikiseo.setup.php"); # add relation links header # details: http://www.mediawiki.org/wiki/extension:relationlinks require_once( "$ip/extensions/relationlinks/relationlinks.php" );  # amazon - doesn't make me money allow users buy #               books include("extensions/amazon.php");  # provide section heading numbers $wgdefaultuseroptions['numberheadings'] = 1;  # provide access outside feeds require_once( "$ip/extensions/wikiarticlefeeds/wikiarticlefeeds.php" ); require_once( "$ip/extensions/rss/rss.php" );  $wgfeed = true;                                                                                                                                 // use feed $wgadvertisedfeedtypes = array('rss', 'atom');  // advertise rss , atom $wgfeedcachetimeout = 3600;                                                                                     // 1 hour (3600 sec) between feed cache refre$ $wgfeedlimit = 15;                                                                                                                      // number of results $  #       dynamic page list #               config: http://www.mediawiki.org/wiki/extension:dynamicpagelist_(wikimedia) require_once("$ip/extensions/intersection/dynamicpagelist.php"); # show exceptions install/dev purposes - gts 04/11/13 #$wgshowexceptiondetails = true;  // prevent new account creation (spam) - gts 06/10/13 //$wggrouppermissions['*']['createaccount'] = false;   // disables write access (page editing , creation) default, creates group named "write", , grants //      write access. users can manually added group via special:userrights. //      http://www.mediawiki.org/wiki/manual:user_rights $wggrouppermissions['*']['edit'] = false; $wggrouppermissions['*']['createpage'] = false; $wggrouppermissions['user']['edit'] = false; $wggrouppermissions['user']['createpage'] = false; $wggrouppermissions['write']['edit'] = true; $wggrouppermissions['write' ]['createpage'] = true; $wggrouppermissions['sysop']['edit'] = true; $wggrouppermissions['sysop' ]['createpage'] = true; 

-------- solution ---------

i added following /etc/apache2/sites-available/wikis.controltheorypro.com.conf , restart apache server.

# mediawiki security         <directory /var/www/html/ctp/mediawiki-1.24.2/>                 # ignore .htaccess files                 allowoverride                  # serve html plaintext, don't execute shtml                 #addtype text/plain .html .htm .shtml .php                  # don't run arbitrary php code.                 #php_admin_flag engine off                  # if you've other scripting languages, disable them too.         </directory>          # mediawiki uploads security         <directory /var/www/html/ctp/mediawiki-1.24.2/images>                 # ignore .htaccess files                 allowoverride none                  # serve html plaintext, don't execute shtml                 addtype text/plain .html .htm .shtml .php                  # don't run arbitrary php code.                 php_admin_flag engine off                  # if you've other scripting languages, disable them too.         </directory> 

make sure, checked following points: - mod_rewrite module enabled - allow htaccess overwrite settings want (check, if allowoverwride directive set, e.g. (that easiest value) all, see http://httpd.apache.org/docs/current/de/mod/core.html#allowoverride

# directory definition allowoverwride # other definitions 

after , restart/reload, short urls should work.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -