【发布时间】:2014-11-15 14:37:44
【问题描述】:
因为我们要启动网站,我不得不将网站 url 从 devdom.com 更改为 livedom.com,开始页面加载很好,但我 无法加载其他页面,除非我停用漂亮的 url/永久链接设置! 在我更改网站 url 之前,它曾经可以正常工作。如果我使用任何永久链接设置,服务器将向我抛出 404 not found 消息。
我做了什么:
- 更改 wp-config.php 中的
DOMAIN_CURRENT_SITE属性 - 使用 wp-config.php 更改
WP_HOME和WP_SITEURL(我在 db 中检查过,值已正确更新) - 运行 db 搜索替换脚本(参见 https://interconnectit.com/products/search-and-replace-for-wordpress-databases/),效果很好
我的 .htaccess 的内容是:
# WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# Media Library
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
# Disallow access to important files
<FilesMatch "(^\.|wp-config\.php|xmlrpc\.php|(?<!robots)\.txt|(liesmich|readme)\.*)">
Order deny,allow
Deny from all
</FilesMatch>
# Prevent Directory Listings
Options -Indexes
我在 ubuntu 服务器上使用 apache,wordpress 版本是 4.0。
希望你们能帮助我,将不胜感激。
谢谢,
浪人
****** 更新 ******
- 我不确定这是否重要,但这是一个网络/多站点安装。
- 另外,我在 vshost 文件 /etc/apache2/sites-available/www.devdom.com.conf 上将
ServerName指令设置为 www.livedom.com
【问题讨论】:
标签: php wordpress apache .htaccess permalinks