WordPress“Post 名称”永久链接不起作用
Wordpress “Post name” permalinks not working
我在 Ubuntu 服务器 14.04 上的 Lamp 服务器上有一个 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
您是否像此处所述启用了 .htaccess 的使用?
https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles
我找到了修复方法。太开心了!
简而言之,我的解决方法是进入 WordPress 管理仪表板,转到:
“设置”>“永久链接”>“常用设置”,并将单选按钮设置为“自定义结构”
,并粘贴到文本框中:
/index.php/%year%/%monthnum%/%day%/%postname%/
,然后单击保存按钮
对于那些 运行 apache 2.4 但没有找到“默认”的人,请在 /etc/apache2/apache2.conf 中查找并编辑
目录
AllowOverride All
目录
目录/var/www/>
AllowOverride All
目录
我在 Ubuntu 服务器 14.04 上的 Lamp 服务器上有一个 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
您是否像此处所述启用了 .htaccess 的使用? https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles
我找到了修复方法。太开心了!
简而言之,我的解决方法是进入 WordPress 管理仪表板,转到:
“设置”>“永久链接”>“常用设置”,并将单选按钮设置为“自定义结构”
,并粘贴到文本框中:
/index.php/%year%/%monthnum%/%day%/%postname%/
,然后单击保存按钮
对于那些 运行 apache 2.4 但没有找到“默认”的人,请在 /etc/apache2/apache2.conf 中查找并编辑
目录
AllowOverride All
目录
目录/var/www/>
AllowOverride All
目录