在我的 WordPress 3.5.2 站点的前端,我有三个按钮:主页、博客和示例页面。当我的永久链接设置设置为 时Default
,我可以访问这三个页面:
Home: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/
Blog: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/?page_id=13
Sample Page:
http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/?page_id=2
但是,当我将永久链接设置更改为Post name
并刷新浏览器时,我无法访问博客页面和示例页面。我收到以下错误:
Blog: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/blog
Not Found
The requested URL /blog/ was not found on this server.
Sample Page:
http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/sample-page/
Not Found
The requested URL /sample-page/ was not found on this server.
在 WordPress 中Settings -> Permalink Settings
,我也收到此消息:
If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.
当我检查我对 .htaccess 文件的权限时,我得到了 644,所以我将其更改为 666 并且消息消失了(我将其更改回 644)
[ec2-user@ip-xx-xxx-xxx-xx html]$ ls -l .htaccess
-rw-r--r-- 1 root root 258 Jul 25 21:49 .htaccess
[ec2-user@ip-xx-xxx-xxx-xx html]$ sudo chmod 666 .htaccess
将永久链接设置更改为 后,我仍然可以访问我的主页Post name
。我不确定这是否与我的问题有关,但我将 WordPress 站点安装在我的 Amazon EC2 微实例上的子目录 (xxx) 中,并且我更改了 WP 的常规设置,如下所示:
WordPress Address (URL): http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/xxx
Site Address (URL): http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com