简体   繁体   English

在没有404的Rails内正确安装Wordpress?

[英]Properly install Wordpress inside Rails without 404s?

I have a Rails site, and I would like to install Wordpress inside the /public directory. 我有一个Rails网站,我想在/ public目录中安装Wordpress。

I did this, and it works fine, except when I click on an article, it 404s. 我做到了,它工作正常,除了当我单击文章时,它是404s。 See http://aromapersona.com/blog/ . 参见http://aromapersona.com/blog/

How do I keep it from 404ing? 如何避免404处理? I'm assuming I have to add a route. 我假设我必须添加一条路线。

I'm using Apache and Passenger. 我正在使用Apache和Passenger。

What ended up working was this in a .htaccess file: 最终起作用的是.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> 

You can disable Passenger in your VirtualHost for a particular location for example 例如,您可以在VirtualHost中为特定位置禁用“乘客”

<Location /your/railsfolder/path/public/blog>
    PassengerEnabled off
</Location>

You may want to do something about the Directory directives as well inside. 您可能还想对Directory指令进行内部处理。 :) :)

I don't think you have to do anything specifically with the Rails routes. 我认为您不必对Rails路线做任何特别的事情。 I have a Rails 2.3.8 app setup that works just like this, and there is nothing specific in the Rails app itself. 我有一个像这样工作的Rails 2.3.8应用程序设置,并且Rails应用程序本身没有特定的内容。

I am assuming the wordpress blog is sitting in public/blog . 我假设wordpress博客位于public/blog

You should be able to add PassengerEnabled Off inside the public/blog/.htaccess . 您应该能够在public/blog/.htaccess添加PassengerEnabled Off

You'll also want to check your Wordpress settings and make sure that the Wordpress address and Blog address urls are both pointing to http://aromapersona.com/blog 您还需要检查Wordpress设置,并确保Wordpress addressBlog address网址都指向http://aromapersona.com/blog。

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

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