如果页面不存在,SEF Joomla不工作(404)


SEF Joomla not working if page not exist (404)

我有一台带有Centos 6.5、Joomla和Nginx的服务器。一切都很好,我在joomla中启用了SEF,可以使用友好的URL,比如:

example.com/the-­news/1­-latest-­news/1-­welcome-­to­-joomla.

在nginxvhostexample.conf中,我放了一行:

   location / {
      try_files $uri $uri/ /index.php?$args;
   }

这很好,但如果我输入一些URL,比如example.com/asdasdasd,那么我会被重定向到主页,索引(example.com),但我会显示joomla默认404错误页面,而不是重定向到索引页面。

有人知道怎么做吗?

谢谢大家!

您可以通过.htaccess文件强制加载404页面:

ErrorDocument 404 http://yourdomain.com/404.php

把它放在.htaccess文件的顶部

编辑:用您的joomla 404 URL替换http://yourdomain.com/404.php