在此服务器上找不到请求的URL / wordpress /

时间:2019-01-25 07:09:48

标签: wordpress apache ubuntu

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

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

1 个答案:

答案 0 :(得分:1)

1)通过单击设置->永久链接

中的保存按钮创建了一个新的

单击该字段,然后按 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服务apache2重新启动

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