[英]Wordpress - Subdirectory - htaccess
I have Wordpress installed in a subdirectory: 我在一个子目录中安装了Wordpress:
/public_html/blog/
I want to be able to access the blog like this: 我希望能够像这样访问博客:
http://example.com/blog
and posts like this: 和这样的帖子:
http://example.com/blog/category/postname
In general settings I have the "WordPress Address (URL)" set to: 在一般设置中,我将“WordPress地址(URL)”设置为:
http://example.com/blog
Permalinks is set like: 永久链接设置如下:
/blog/%category%/%postname%
In the subdirectory (/public_html/blog/) I have an .htaccess like: 在子目录(/ public_html / blog /)中,我有一个.htaccess,如:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Everything works EXCEPT for being able to access the blog Home page at: http://www.example.com/blog Doing that sends me to the "Wordpress 404 page not found" page. 一切正常,因为能够访问博客主页: http : //www.example.com/blog这样做让我发送到“未找到Wordpress 404页面”页面。
I'd be very grateful for a solution! 我非常感谢解决方案!
EDIT 编辑
I'm an idiot - I missed something vital. 我是个白痴 - 我错过了一些至关重要的东西。 I needed to also change the Site URL in Wordpress > General to:
我还需要将Wordpress> General中的站点URL更改为:
http://example.com/blog
Doing that and then removing /blog/ from the permalink structure made everything work. 这样做然后从永久链接结构中删除/ blog /使一切正常。 I probably wouldn't have spotted this if @IanB hadn't picked up the /blog/ bit not being necessary.
如果@IanB没有拿到没有必要的/ blog /位,我可能不会发现这个。 Thanks...
谢谢...
2 things come to mind. 我想到了两件事。 I don't think you need to add /blog/ in your permalink structure, (unless wordpress is adding that for you).
我认为你不需要在永久链接结构中添加/ blog /(除非wordpress正在为你添加)。 That should be automatic if that is the file it is installed in.
如果这是安装它的文件,那应该是自动的。
Also, Where is your index.php file for your wordpress install - Is it in the blog folder or in the /public_html/ folder. 此外,您的wordpress安装的index.php文件在哪里 - 是在博客文件夹中还是在/ public_html /文件夹中。
If you want to display the blog at http://example.com/blog it should be in the blog folder. 如果您想在http://example.com/blog上显示该博客,则该博客应位于博客文件夹中。
What is the filepath you use to log in? 您用于登录的文件路径是什么? Does that work fine?
那工作正常吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.