I'm trying to separate my article and script paths as described in http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url in order to "steer the googlebot" and now I can't seem to render any images.
I'd originally installed mediawiki (this is on RH Linux) in /var/www/html/wiki so I did a mv to rename this directory to /var/www/html/w
I changed /etc/httpd/conf/httpd.conf
<Directory /var/www/html/w> AllowOverride FileInfo Options php_flag register_globals off </Directory> Alias /wiki/skins "/var/www/html/w/skins" Alias /wiki "/var/www/html/w"
The <Directory>.. block was there but I changed wiki to w I then added the two Alias statements. (and yes I've restarted httpd after each change)
I then changed LocalSettings.php I think that these are the relevant lines:
$IP = "/var/www/html/w";
#without the following line script links come out as /wiki $wgScriptPath = "/w"; $wgScript = "{$wgScriptPath}/index.php"; $wgRedirectScript = "{$wgScriptPath}/redirect.php"; #$wgStylePath = "{$wgScriptPath}/skins"; #Basing style on script hides skins??? $wgStylePath = "/wiki/skins"; $wgStyleSheetPath = &$wgStylePath;
## If using PHP as a CGI module, use the ugly URLs #$wgArticlePath = "$wgScript/$1"; #$wgArticlePath = "$wgScript?title=$1"; $wgArticlePath = "/wiki/$1"; #Default has $wgUploadPath = "{$wgScriptPath}/upload"; #But there is no upload directory and this seems to control where the #Image object looks so. $wgUploadPath = "{$wgScriptPath}/images"; #Ditto for $wgUploadDirectory DefaultSettings.php had this as "{$IP}/uploads" $wgUploadDirectory = "{$IP}/images"; $wgMathPath = "{$wgUploadPath}/math";
$wgLogo = "$wgStylePath/common/images/merclogo.png";
Before I changed $wgUploadPath and $wgUploadDirectory i was getting missingimage messages, I temporarily modified Skin.php to print the imagePath instead of just the name and it seemed to be correct and the files themselves existed. After the change I just get the alt text and no images.
I thought that it might be a permissions problem so I made sure that the owner and group of /var/www/html/w and everything below it is apache,apache
Any ideas? I'm pretty much stumped at this time.
Rick DeNatale wrote:
<Directory /var/www/html/w> AllowOverride FileInfo Options php_flag register_globals off
</Directory> Alias /wiki/skins "/var/www/html/w/skins" Alias /wiki "/var/www/html/w"
The alias for /wiki/skins is redundant, as it's already covered by the alias for /wiki.
$IP = "/var/www/html/w";
#without the following line script links come out as /wiki $wgScriptPath = "/w"; $wgScript = "{$wgScriptPath}/index.php"; $wgRedirectScript = "{$wgScriptPath}/redirect.php";
Looks like standard config so far...
#$wgStylePath = "{$wgScriptPath}/skins"; #Basing style on script hides skins??? $wgStylePath = "/wiki/skins";
I'm not sure I understand why this bit is done.
## If using PHP as a CGI module, use the ugly URLs #$wgArticlePath = "$wgScript/$1"; #$wgArticlePath = "$wgScript?title=$1"; $wgArticlePath = "/wiki/$1";
Unless you've made some other configuration on the web server, this would appear to break all article URLs, because they'd be aliased to files as /var/www/html/w/$1.
#Default has $wgUploadPath = "{$wgScriptPath}/upload"; #But there is no upload directory and this seems to control where the #Image object looks so. $wgUploadPath = "{$wgScriptPath}/images"; #Ditto for $wgUploadDirectory DefaultSettings.php had this as "{$IP}/uploads" $wgUploadDirectory = "{$IP}/images"; $wgMathPath = "{$wgUploadPath}/math";
$wgLogo = "$wgStylePath/common/images/merclogo.png";
Before I changed $wgUploadPath and $wgUploadDirectory i was getting missingimage messages, I temporarily modified Skin.php to print the imagePath instead of just the name and it seemed to be correct and the files themselves existed. After the change I just get the alt text and no images.
I'm not sure I understand what you changed it from or to. What did your LocalSettings.php contain before this? If you used a standard configuration it should have looked like:
$wgUploadPath = "$wgScriptPath/images"; $wgUploadDirectory = "$IP/images";
which appears to be exactly equivalent to what you changed it _to_. So what was it before, and why was it different?
-- brion vibber (brion @ pobox.com)
On 6/16/05, Brion Vibber brion@pobox.com wrote:
Rick DeNatale wrote:
<Directory /var/www/html/w> AllowOverride FileInfo Options php_flag register_globals off
</Directory> Alias /wiki/skins "/var/www/html/w/skins" Alias /wiki "/var/www/html/w"
The alias for /wiki/skins is redundant, as it's already covered by the alias for /wiki.
You're right. Here's how I got there. I started with the two Aliases in the quoted article, which has the second as" Alias /wiki /var/www/html/w/index.php
The problem is that, because I'm stuck for the moment on RH9 and can't update PHP I have to use rewrite which was already working, the urls were getting rewritten as .../index.php/index.php I found that changing the second alias fixed that.
$IP = "/var/www/html/w";
#without the following line script links come out as /wiki $wgScriptPath = "/w"; $wgScript = "{$wgScriptPath}/index.php"; $wgRedirectScript = "{$wgScriptPath}/redirect.php";
Looks like standard config so far...
#$wgStylePath = "{$wgScriptPath}/skins"; #Basing style on script hides skins??? $wgStylePath = "/wiki/skins";
I'm not sure I understand why this bit is done.
Because DefaultSettings.php says that If $wgScriptPath is localized then anything based on it has to be localized. So I used grep to find out all of the references to $wgScriptPath in DefaultSettings and copied those to LocalSettings so that they would be based on the new setting of $wgScriptPath set in LocalSettings after the include of DefaultSettings. I did the transitive closure of this operation which picked up a few more variables.
As I tried to explain in the comment, If I follow this pattern and set $wgStylePath = "{$wgScriptPath}/skins" where $wgScriptPath = "/w" for some reason, Apache doesn't seem to serve up the css files, so I end up with no tabs, sidebar etc.
Not sure why, but that's what happens.
## If using PHP as a CGI module, use the ugly URLs #$wgArticlePath = "$wgScript/$1"; #$wgArticlePath = "$wgScript?title=$1"; $wgArticlePath = "/wiki/$1";
Unless you've made some other configuration on the web server, this would appear to break all article URLs, because they'd be aliased to files as /var/www/html/w/$1.
As I said I'm using rewrite, which was already working, here are the rewrite rules, right now these are in /var/www/html/w/.htaccess:
-------- RewriteEngine on # Don't rewrite requests for files in MediaWiki subdirectories, # MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins)/ RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteCond %{REQUEST_URI} !^/robots.txt
# Rewrite any article as wiki/index.php/article and stop RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA] ------- I've also got a rewrite rule in a virtual server directive to rewrite null uris RewriteRule ^/$ "/var/www/html/w/"
I have to admit that I don't understand just how this works but it does, it worked before the other changes, except tht the w was wiki.
This seems to be working, I can get articles I just can't get images
#Default has $wgUploadPath = "{$wgScriptPath}/upload"; #But there is no upload directory and this seems to control where the #Image object looks so. $wgUploadPath = "{$wgScriptPath}/images"; #Ditto for $wgUploadDirectory DefaultSettings.php had this as "{$IP}/uploads" $wgUploadDirectory = "{$IP}/images"; $wgMathPath = "{$wgUploadPath}/math";
$wgLogo = "$wgStylePath/common/images/merclogo.png";
Before I changed $wgUploadPath and $wgUploadDirectory i was getting missingimage messages, I temporarily modified Skin.php to print the imagePath instead of just the name and it seemed to be correct and the files themselves existed. After the change I just get the alt text and no images.
I'm not sure I understand what you changed it from or to. What did your LocalSettings.php contain before this? If you used a standard configuration it should have looked like:
$wgUploadPath = "$wgScriptPath/images"; $wgUploadDirectory = "$IP/images";
which appears to be exactly equivalent to what you changed it _to_. So what was it before, and why was it different?
That is what it was before. Here's a diff of LocalSettings.php between what it is now and a backup from last night
[rick@frodo rick]$ diff /var/www/html/w/LocalSettings.php /snapshot/daily.1/var/www/html/wiki/LocalSettings.php 7c7 < $IP = "/var/www/html/w"; ---
$IP = "/var/www/html/wiki";
25,31c25,27 < $wgScriptPath = "/w"; < $wgScript = "{$wgScriptPath}/index.php"; < $wgRedirectScript = "{$wgScriptPath}/redirect.php"; < #$wgStylePath = "{$wgScriptPath}/skins"; < #Basing style on script hides skins??? < $wgStylePath = "/wiki/skins"; < $wgStyleSheetPath = &$wgStylePath; ---
$wgScriptPath = "/wiki"; $wgScript = "$wgScriptPath/index.php"; $wgRedirectScript = "$wgScriptPath/redirect.php";
36,46c32,34 < $wgArticlePath = "/wiki/$1"; < $wgUploadPath = "{$wgScriptPath}/upload"; < #But there is no upload directory and this seems to control where the < #Image object looks so. < #$wgUploadPath = "{$wgScriptPath}/images"; < #Ditto for $wgUploadDirectory DefaultSettings.php had this as "{$IP}/uploads" < $wgUploadDirectory = "{$IP}/images"; < < $wgMathPath = "{$wgUploadPath}/math"; < < ---
$wgArticlePath = "$wgScriptPath/$1"; $wgStylePath = "$wgScriptPath/skins"; $wgStyleDirectory = "$IP/skins";
48a37,38
$wgUploadPath = "$wgScriptPath/images"; $wgUploadDirectory = "$IP/images";
131c121 < "/var/www/html/w/extensions/SpamBlacklist/wikimedia_blacklist", // Wikimedia's list ---
"/var/www/html/wiki/extensions/SpamBlacklist/wikimedia_blacklist", // Wikimedia's list
Any help appreciated.
Rick DeNatale wrote:
On 6/16/05, Brion Vibber brion@pobox.com wrote:
#$wgStylePath = "{$wgScriptPath}/skins"; #Basing style on script hides skins??? $wgStylePath = "/wiki/skins";
I'm not sure I understand why this bit is done.
Because DefaultSettings.php says that If $wgScriptPath is localized then anything based on it has to be localized.
This is already done in the default LocalSettings.php boilerplate produced by the installer. Normally you do not need to change any of those definitions except $IP, $wgScriptPath, and $wgArticlePath.
As I tried to explain in the comment, If I follow this pattern and set $wgStylePath = "{$wgScriptPath}/skins" where $wgScriptPath = "/w" for some reason, Apache doesn't seem to serve up the css files, so I end up with no tabs, sidebar etc.
You probably should look into that; mysterious problems in an alias / rewrite config are likely to, well, cause mysterious problems.
In what _way_ are they not served? 404? 403? 500? Segfault? Can you confirm that the path was correct, and that that path was actually being used? Always clear caches, etc when testing this stuff.
## If using PHP as a CGI module, use the ugly URLs #$wgArticlePath = "$wgScript/$1"; #$wgArticlePath = "$wgScript?title=$1"; $wgArticlePath = "/wiki/$1";
Unless you've made some other configuration on the web server, this would appear to break all article URLs, because they'd be aliased to files as /var/www/html/w/$1.
As I said I'm using rewrite, which was already working, here are the rewrite rules, right now these are in /var/www/html/w/.htaccess:
RewriteEngine on # Don't rewrite requests for files in MediaWiki subdirectories, # MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins)/ RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteCond %{REQUEST_URI} !^/robots.txt
# Rewrite any article as wiki/index.php/article and stop RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA]
That's kind of odd... Why's it in the w subdirectory if that's where you _don't_ want things rewritten? It looks like this could be causing your style breakage, since you're using a strange system where you except certain hardcoded URLs (which won't match, being in /w/ not /wiki/) and then shove anything and everything else through a rewrite.
I would strongly recommend removing the Alias definitions and all those rewrite rules and replacing them with something straightforward like:
RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [L,QSA]
Or alternatively a single Alias such as this might work, using the PATH_INFO supplement for the page title:
Alias /wiki /var/www/html/w/index.php
-- brion vibber (brion @ pobox.com)
On 6/16/05, Brion Vibber brion@pobox.com wrote:
I would strongly recommend removing the Alias definitions and all those rewrite rules and replacing them with something straightforward like:
RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [L,QSA]
Thanks,
I realized that I was trying to build a hack on a hack. I'd hacked something before with rewrite to get 'nice' urls which strayed from other how-tos because I'd installed in wiki instead of w.
So I backed off, and renamed LocalSettings.php and "reinstalled" 1.4.5. I now have everything working except rewriting an empty uri. I have several name based virtual hosts and would like one of them to rewrite an empty uri to /wiki/Main_Page and then do a local rewrite to /w/indec.php?title=Main_Page
That's the last part that I can't seem to get working.
Usually, the rewrite rule RewriteRule ^wiki(.*)$ w/index.php$1 [L] or similar is recomended, used in the directory containing "w".
This would rewrite /wiki to /w/index.php, /wiki/ to /w/index.php/, and /wiki/Main_Page to /w/index.php/Main_Page.
You would need to enable PATH_INFO for this to work. Also, if you're using anything like (in my case), /wiki5, you would need to put that _before_ the one above, otherwise it rewrites /wiki5 to /w/index.php5.
Make sure script path is /w..., not /wiki.
On 6/16/05, Rick DeNatale rick.denatale@gmail.com wrote:
On 6/16/05, Brion Vibber brion@pobox.com wrote:
I would strongly recommend removing the Alias definitions and all those rewrite rules and replacing them with something straightforward like:
RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [L,QSA]
Thanks,
I realized that I was trying to build a hack on a hack. I'd hacked something before with rewrite to get 'nice' urls which strayed from other how-tos because I'd installed in wiki instead of w.
So I backed off, and renamed LocalSettings.php and "reinstalled" 1.4.5. I now have everything working except rewriting an empty uri. I have several name based virtual hosts and would like one of them to rewrite an empty uri to /wiki/Main_Page and then do a local rewrite to /w/indec.php?title=Main_Page
That's the last part that I can't seem to get working. _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org