Wamp基本配置:"The requested URL /my-site/ was not found on this server."

Wamp basic configuration: "The requested URL /my-site/ was not found on this server."

我刚刚在一台新电脑上安装了 Wamp Windows 10,但我没有成功访问“www”文件夹中的任何项目。

例如,我用一个简单的 index.html 文件创建了文件夹“C:\wamp64\www\my-site”,但是当我启动“localhost/my-site/",我有以下错误:

Not Found

The requested URL /my-site/ was not found on this server.


Apache/2.4.17 (Win64) PHP/5.6.16 Server at localhost Port 80

另一方面,“localhost/" and "localhost/phpmyadmin/”工作得很好。

我检查了httpd.conf 飞了,一切似乎都没问题:

#...
Listen 0.0.0.0:80
Listen [::0]:80
#...
ServerName localhost:80
#...
DocumentRoot "C:/wamp64/www/"
#...

有什么办法可以解决我的问题吗?

提前致谢!

我刚刚找到我的问题所在。

我没有创建 index.html 而是 index.html.txt ...

令我困扰的是,对于 Wamp 3,错误是 404 错误。使用 Wamp 2,当您没有索引文件(或 .htaccess)时,它会向您显示文件夹内容。

我遇到了这个问题。 phpmyadmin 运行良好,但不允许访问其他项目。 wamp 服务器 3 不允许访问文件夹和文件列表。此文件夹必须包含至少一个 index.php 或 .htaccess 因此,如果 index.php 挡住了 www/myproject/folder1/index.php。如果你写 localhost / myproject / 访问将被拒绝。所以你必须写 localhost / myproject / folder1

在 localhost/my-site/

中测试创建 index.php

我花了 2 天时间尝试了所有我能读到的东西...没有任何效果。

然后我查看了数据库,wp_posts table 并在 "guid" 列下看到 URLs (www.example.com/?p=43) 看起来与当您在编辑页面 mode 或当您想要 "Preview" (www.example.com/2016/sample-posts/) 时,永久链接在 Wordpress 中的样子。这让我失望了。

所以我进入了 Wordpress 仪表板 >> 设置 >> 固定链接,并将固定链接设置更改为与 wordpress 中实际固定链接格式相匹配的格式。

中提琴!

希望对您有所帮助。

PS:确保您的 Apache httpd.conf 文件设置为允许 mod-重写。寻找这一行:

#LoadModule rewrite_module modules/mod_rewrite.so

干脆去掉前面的井号。所以它看起来像这样:

LoadModule rewrite_module modules/mod_rewrite.so