我在AWS EC2同一个实例下挂了2个wordpress,第一个一切正常,第二个除了主页,访问其他页面都提示“The requested URL was not found on this server”。原来是站点2缺少.htaccess
文件。
我在AWS EC2同一个实例下挂了2个wordpress,第一个一切正常,第二个除了主页,访问其他页面都提示“The requested URL was not found on this server”。最开始以为是文件权限的原因,还花了不少时间,较为系统了解了下文件的操作权限(详情见博文《将AWS EC2中网页服务器目录/var/www/的权限设到最优》),仔细设置好文件(夹)权限后,并且再次检查apache2/sites-available/
下的配置文件,还是不行。
最后在StackOverflow提问(问题在这里),今天得到回答,提示我检查.htaccess
文件。一检查,才发现站点2压根就没有.htaccess
文件,于是在站点2目录下创建之,内容如下:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
现在一切正常了。关于.htaccess
,摘抄维基百科词条.htaccess部分内容如下:
A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server’s global configuration for the directory that they are in, and all sub-directories.[1]
The original purpose of .htaccess—reflected in its name—was to allow per-directory access control by, for example, requiring a password to access the content. More commonly, however, the .htaccess files override many other configuration settings such as content type,character set, CGI handlers, etc.
专题: AWS上建立wordpress站点 (8/10)
微信赞赏
支付宝赞赏
Hi, this wеekend iѕ nice for me, because thіs point inn time i am reading tniѕ great informɑtіve
pоst here at my residence.
Adorable ahyu83 http://ahyu83.ga/! contente de mien achat bonnes fetes en compagnie de bout d’annee
我的网站解决不了这问题啊,首页正常,内页异常
Not Found
The requested URL /1/2/obadaptor was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
匯豐銀行網頁開不到,為什麼???help me ???jy3874@qq.com
您好,我还是出现这个问题,请问要怎么更新htaccess?
添加之后,在访问直接“您访问的网页出错了”【代码上传到主机里之后】
没有错误代码?
咋打不开页面
我这边没问题,你再试试?
Pingback: wordpress成功搬家
Pingback: AWS EC2一个实例下安装多个wordpress | Spark & Shine