【问题标题】:The requested URL /wordpress/ was not found on this server在此服务器上找不到请求的 URL /wordpress/
【发布时间】:2019-01-25 07:09:47
【问题描述】:

我对 wordpress 很陌生,我使用 tutorial 在我的系统上安装了它,一切正常,我的 wordpress 正常工作,我设置了所有内容并关闭了我的系统。当我重新启动系统并访问http://localhost/wordpress/ 时出现此错误

Not Found

The requested URL /wordpress/ was not found on this server.

Apache/2.4.18 (Ubuntu) Server at localhost Port 80

在互联网上搜索了一段时间后,我尝试了许多修复方法,例如:

sudo nano /etc/apache2/apache2.conf

并更改权限,但直到现在我都没有这样做。

希望得到你们的积极回应。

apache2.conf

Mutex file:${APACHE_LOCK_DIR} default

PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300


KeepAlive On


MaxKeepAliveRequests 100

KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}


HostnameLookups Off


ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All

</Directory>

<Directory /usr/share>
    AllowOverride All

</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All

</Directory>


<Directory /opt/lampp/htdocs/wordpress/>
    AllowOverride All
  Allow from All

</Directory>






AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>



LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

【问题讨论】:

  • 你在apache2.conf中有这个目录的定义吗?
  • 是的,我添加了 apache2.conf,请查看@RomeoNinov
  • 尝试将DocumentRoot 添加到wordpress 的Directory 定义
  • 真的很抱歉,但我不知道该怎么做你能告诉我@RomeoNinov
  • 请查看我的回答

标签: wordpress apache ubuntu


【解决方案1】:

1)通过点击Settings->Permalinks

中的保存按钮创建新的

在字段中单击并按 CTRL + a 以全选。粘贴到 .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

2) 现在,需要激活mod_rewrite

sudo a2enmod 重写

这将激活模块或提醒您该模块已生效。要使这些更改生效,请重新启动 Apache:

sudo service apache2 重启

现在页面开始正常工作了...

【讨论】:

    猜你喜欢
    • 2017-08-20
    • 1970-01-01
    • 1970-01-01
    • 2014-03-05
    • 2019-07-14
    • 2018-05-08
    • 2021-07-23
    • 2017-03-21
    • 2010-10-16
    相关资源
    最近更新 更多