[MediaWiki-l] htaccess and stuff

Steve VanSlyck s.vanslyck at spamcop.net
Sun Jan 20 19:02:18 UTC 2013


First, um, is this the correct list to be posting general quetsions to?

Second, a very knowledgable person has advised me:

    "As I told you already, set the configuration variables to the
    canonical paths. As long as you keep it set to a target that is a
    redirect, things like saving preferences will be broken and
    everything else will be delayed or slow. Your server is configured
    as "www.mysite.us" with "mysite.us" as a redirect to that. If your
    wiki is configured as "mysite.us" then any and all requests and
    submissions will go to that, only to be redirected to
    "www.mysite.us". Redirects don't handle POST submissions very well,
    only GET requests. As a result, Preferences can't be saved (this is
    not MediaWiki related actually but general web server behaviour)."

I'm really not sure what this means. There are all kinds of definitions 
of "canonical paths" out there but none I've found have given me an 
example of what a canonical path actuall IS.

In general, I want my users to be seeing "www" in their address path. I 
also don't want script path and article path arguing with each other. I 
renamed my /wiki/ directory to /w/ and then changed my .htaccess file to 
what is shown below. It appears to work for me, but is it correct?

Should I change $wgServer = "http://mysite.us"; to $wgServer = 
"http://www.mysite.us";   and get rid of the redirect at the beginning? 
Do something else?

# Follow symbolic links (dunno if this is needed or not)
Options +FollowSymLinks

# Enable the rewrite engine
RewriteEngine On

# Do some magic stuff that forces pages to use www
RewriteCond %{HTTP_HOST} !^www\.mysite\.us [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.mysite.us/$1 [L,R,NE]

# Write something here soon
RewriteCond %{REQUEST_FILENAME} !-f

# Short url for wiki pages
RewriteRule ^/?wiki(/.*)$ /w/index.php?title=$1 [L,QSA]
  
# Redirect / to Main Page
# RewriteRule ^/*$ /w/Main_Page [L,QSA] <-------wiki didn't work with this line
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]

Here are what I think are the relevant portions of LocalSettings.php.

## The protocol and server name to use in fully-qualified URLs
$wgServer           = "http://mysite.us";

## The relative URL path to the skins directory
$wgStylePath        = "$wgScriptPath/skins";

#
# BUNCH OF STUFF CHOPPED OUT HERE FOR THE THE LIST POST
#
# End of automatically generated settings.
# Add more configuration options below.
#
# BUNCH OF STUFF CHOPPED OUT HERE FOR THE THE LIST POST
#
# FAVICON IDENTITY
$wgFavicon = "$wgScriptPath/favicon.ico";

# Enable Short URLs
# http://www.mediawiki.org/wiki/Manual:Short_URL
$wgUsePathInfo = true;
$wgArticlePath = "/wiki/$1";





More information about the MediaWiki-l mailing list