【发布时间】:2015-08-22 04:56:59
【问题描述】:
我有一个在 Ubuntu Server 14.04 上的 Lamp Server 上运行的 Wordpress 网站。
我只是尝试使用Post Name 永久链接的选项,现在我的页面不再加载。
我打开了Apache服务器的mod_rewrite功能,重启了,还是不行。
另外,这是我的.htaccess 文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
注意/wordpress文件夹的内容已经直接放在/html里面了
假设我的网站名称是mywebsite.com。
我怎样才能让它工作?
编辑:这是我的/etc/apache2/sites-available/000-default.conf 文件
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
【问题讨论】:
-
您是说您的 WordPress 安装在您文档根目录的
wordpress目录中吗?即你可以通过mywebsite.com/wordpress/访问它? -
在Apache的根目录下
-
如果它在您的文档根目录中,那么它应该可以正常工作。您确定在您的固定链接设置中显示
/%postname%/? -
如果你将它切换回基于日期的永久链接,它会起作用吗?如果是这样,那么我假设您调用了错误的 URI。如果不是这种情况,请描述实际问题,例如您遇到的错误是来自 Apache 还是来自 WordPress?
-
现在,当我单击主页以外的某个链接时,我得到的只是“未找到”。此外,默认永久链接可以正常工作,但我想要的帖子名称却不行
标签: wordpress .htaccess lamp permalinks ubuntu-server