(20024)The given path misformatted or contained invalid characters: 问题
(20024)The given path misformatted or contained invalid characters:
查看apache的错误日志显示如下:
[Fri May 11 12:18:40 2009] [error] [client 192.168.67.204] (20024)The given path misformatted or contained invalid characters: Cannot map GET /wiki/User:Rbk HTTP/1.1 to file, referer: http://itsupport/wiki/Main_Page [Fri May 11 12:18:47 2009] [error] [client 192.168.67.204] (20024)The given path misformatted or contained invalid characters: Cannot map GET /wiki/User_talk:Rbk HTTP/1.1 to file, referer: http://itsupport/wiki/Main_Page [Fri May 11 12:18:56 2009] [error] [client 192.168.67.204] (20024)The given path misformatted or contained invalid characters: Cannot map GET /wiki/ITSupportWiki:Community_Portal HTTP/1.1 to file, referer: http://itsupport/wiki/Main_Page 就是所有要显示的页里有冒号都出这个错,这种事是apache2在微软的windows环境
All Pages with a ":" in the address receive this error.
Pages display with a 403 ERROR.
Apache 2 on Windows
PHP 5
解决办法可采用URL rewriting办法修改.htaccess
另外在mediawiki可采用设置参数不让显示:
LocalSettings.php:
$wgArticlePath = $wgScriptPath.'/index.php?title=$1';
附原文:
That's a problem with Apache in Windows - there's an entry in the Apache bugzilla. It's been there a long time.
The problem is that Windows forbids a colon in the path except where a drive specification is set - C:/.... No one seems to know what to do about it.
I get those but the page displays nonetheless. Are you doing any URL rewriting?
Code:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*) /wiki/index.php?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ wiki/ [L,QSA] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Try adding a rule before all the other rules that skips the rewrite when a colon in in the URL. E.g.:
Code:
RewriteCond %{REQUEST_URI} ^/(.*)MediaWiki: [OR,NC] RewriteCond %{REQUEST_URI} ^/(.*)Talk: [OR,NC] RewriteCond %{REQUEST_URI} ^/(.*)Template: [OR,NC] RewriteCond %{REQUEST_URI} ^/(.*)User: [OR,NC] RewriteCond %{REQUEST_URI} ^/(.*)Special: [NC] RewriteRule ^(.*)$ - [S=nnnn]
You'll have to replace nnnn with the number of rewrite rules to skip. I'm not sure how you count the conditional rules you have there.
It goes in the Apache configuration file - either httpd.conf or htaccess.
URL rewriting is not for the faint of heart. See mod_rewrite
A simpler way than use rewrite rules, is setting MediaWiki to use the article names as parameters instead of using them as file names.
I have just added the following in LocalSettings.php:
$wgArticlePath = $wgScriptPath.'/index.php?title=$1';
And all worked fine for me.
Regards,
Jeferson Oliveira
Brazil