简体   繁体   English

WordPress网站显示404非www查询

[英]wordpress website is showing 404 for non-www queries

I am having a django python website in domain.com. 我在domain.com中拥有django python网站。 I am having a blog in a folder called as fmblog inside my public html. 我在公共html的fmblog文件夹中有一个博客。 I want to access blog by entering domain.com/blog. 我想通过输入domain.com/blog访问博客。

My blog is situated in /home/user/public_html/fmblog 我的博客位于/ home / user / public_html / fmblog

So, I have an alias in my virtualhost configuration like the following. 因此,我在虚拟主机配置中有一个别名,如下所示。

Alias /blog /home/user/public_html/fmblog/

My issue is that, I am getting the blog when I try to access www.domain.com/blog. 我的问题是,当我尝试访问www.domain.com/blog时,我正在获取博客。 I am getting a 404 error when I try to access http://domain.com/blog . 尝试访问http://domain.com/blog时出现404错误。

Why is this happening? 为什么会这样呢? I know this will be fixed if I redirect every non-www requests to www using a rewrite rule. 我知道如果我使用重写规则将每个非www请求重定向到www都可以解决。 But I dont want to use that as it have some bad effects in my django website. 但是我不想使用它,因为它在我的django网站中有一些不良影响。 How can I make my blog live even on non-www queries? 即使在非www查询中,如何使我的博客生效?

您只能为博客进行重定向,将规则添加到#BEGIN WordPress行上方的fmblog中的.htaccess中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM