不能发邮件是因为没有安装发邮件的服务
sudo apt-get install sendmail
sudo service sendmail start
然后就可以了
分类目录归档:Wordpress
WordPress: modify the upload list of allowed file types
When you attempt to upload a file in WordPress that is not in the default list of acceptable file types, you will receive the following error: File type does not meet security guidelines. Try another.
While there’s no admin-based tool for editing list of allowed file types, it’s not at all difficult to add your own or remove any existing.
Upload filetypes are checked by the function wp_check_filetype in wp-includes/functions.php. But we will add new file types to the file functions.php in our template due to upgrade WordPress.
Open your theme’s functions.php
file and add this line somewhere between the <?php
and ?>
:
add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes ( $existing_mimes=array() ) { // add your extension to the array $existing_mimes['deb'] = 'application/x-deb'; // add as many as you like // removing existing file types unset( $existing_mimes['exe'] ); // add as many as you like // and return the new full result return $existing_mimes; }
In this case I allowed upload .deb files and banned upload .exe files. List of MIME Types can be found here, or use google, if your file type is not in the list (e.g. deb or rpm file type).
IIS7 WordPress 中文 URL 解决方案
1、
使用插件 IIS Chinese Tag Permalink
2、
用 WordPress 写中文博客时 URL 中经常会包含中文字符,一般出现在 Tag 和分类的 URL 中。而 IIS7 对包含中文的 URL 支持有问题。这样的情况下访问如「http://sheng00.com/tag/软件」这样的 URL 就会发生 404 错误。
像 Godaddy 的 Windows 主机正是使用 IIS7 作为 Web 服务器的,在此空间上使用 WordPress 就会出现以上问题,虽然可以通过修改程序文件或者修改 Tag 和分类的别名为英文的方法来解决,但非常不实用。
下面介绍一种解决方法,只需要增加一个 PHP 文件,并修改一下 web.config 文件中的 Rewrite 规则即可,不需要修改程序文件。
新建一个“chineseurl.php”文件,内容如下:
<?php if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { // IIS Mod-Rewrite $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // IIS Isapi_Rewrite $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } else { // Use ORIG_PATH_INFO if there is no PATH_INFO (!isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) && ($_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']); // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) if (isset($_SERVER['PATH_INFO'])) { ($_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME']) ? ($_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']) : ($_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']); } // Append the query string if it exists and isn't null (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) && ($_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']); } require("index.php"); ?>
修改 web.config 文件内容如下:
?<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="cnUrl" stopProcessing="true"> <match url="^(tag|category)/(.*)$" /> <action type="Rewrite" url="cnurl.php" /> </rule> <rule name="WordPress" patternSyntax="Wildcard"> <match url="*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
以上两个文件都存放在 WordPress 的安装目录。
如果 WordPress 不是装在根目录,则需要更改“<match url=”^(tag|category)/(.*)$” />”为“<match url=”^安装目录/(tag|category)/(.*)$” />”。如果在固定链接设置里把默认的标签前缀和分类目录前缀(tag 和 category)改了,则更改这句里的对应内容即可。
此文适用于 WordPress 2.9,2.9以下版本应该也可以适用,但笔者没有测试过。