首页 文章

如何编辑.htaccess以允许rails和wordpress请求?

提问于
浏览
2

我想在我的rails应用程序中运行wordpress实例 . 我目前有wordpress文件存放在public / wordpress中,但我需要配置我的.htaccess文件以允许两种类型的请求 . 我怎么做?目前,.htaccess是:

一般的Apache选项
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteRule ^ $ index.html [QSA]
RewriteRule ^([^.])/!$ $ 1.html [QSA]
RewriteCond%
! - f
RewriteRule ^( . *)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "Application error Application failed to start properly"

1 回答

  • 4

    您应该首先将其添加到公用文件夹中的.htaccess:

    RewriteCond %{REQUEST_URI} ^/wordpress.*
    RewriteRule .* - [L]
    

    然而,这不是全部 . 您还需要使用此添加来编辑/ etc / apache2 / sites-available /(告诉Rails不要在/ blog中处理任何内容作为应用程序的一部分):

    <Location /wordpress>  
    PassengerEnabled off
    

    同样在/etc/apache2/apache2.conf中,您可能需要告诉Apache使任何目录索引(例如wordpress /)执行index.php文件(如果有):

    DirectoryIndex index.php
    

相关问题