之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

解决您在不同平台环境下遇到的安装和升级问题
回复
头像
pcwuyu
帖子: 10
注册时间: 2013年 12月 18日 19:14
联系:

之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 pcwuyu »

之前的VPS被攻击导致没用了,只能换空间了。但是现在我上传文件以及数据库导入之后却发现出现各种404错误。

百度的结果是需要上传.htaccess文件,但是我的VPS已经重新换为CentOS系统了,现在连后台都进不去,该怎么解决?

我的博客是http://www.pcwuyu.comPC物语

以上!
头像
zyzzc
帖子: 648
注册时间: 2009年 9月 25日 20:11
联系:

Re: 之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 zyzzc »

你的服务器是nginx了,.htaccess是apache用的,百度下nginx的rewrite规则怎么弄吧,我也不是太清楚
头像
hanabi
帖子: 69
注册时间: 2013年 12月 6日 23:23

Re: 之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 hanabi »

Nginx不适用.htaccess做Rewrite,试试这个:

代码: 全选

location / {
   index index.html index.php;
   if (-f $request_filename/index.html){
       rewrite (.*) $1/index.html break;
   }
   if (-f $request_filename/index.php){
       rewrite (.*) $1/index.php;
   }
   if (!-f $request_filename){
       rewrite (.*) /index.php;
   }
}

保存为typecho.conf,并应用。
头像
pcwuyu
帖子: 10
注册时间: 2013年 12月 18日 19:14
联系:

Re: 之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 pcwuyu »

这个保存到哪儿啊??
头像
hanabi
帖子: 69
注册时间: 2013年 12月 6日 23:23

Re: 之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 hanabi »

ssh登录找到你网站配置文件:/usr/local/nginx/conf/vhost/域名.conf
打开后在root /home/wwwroot/域名; 这一行下面添加:
include typecho.conf;
头像
pcwuyu
帖子: 10
注册时间: 2013年 12月 18日 19:14
联系:

Re: 之前在VPS里面设置了永久链接,导致现在换空间的时候404错误

帖子 pcwuyu »

截图
截图
QQ截图20140609145428.png (14.23 KiB) 查看 6733 次

已经有了啊.....
回复