2011-01-26 12 views
4

私たちはsymfonyで動作するサイトを持っています。私はしかし、WordPressでかなり有能で、サイトにブログをインストールします。WordPress Symfonyの共存

現在、サイトのルートはSymfony上で実行されていますが、私はWordPressがSymphonyコアに触れることなく引き継ぐことを望みます。基本的には、私はwwwディレクトリのサブディレクトリ、例えばwww/wordpress/にWordPressをインストールしたいと思います。そしてhtaccessがそのディレクトリを私のドメインのルートとして指し示しています。しかし、Symfonyのインストールの1つの機能があります。私はまだアクセスしたいのですが、myfeatureと呼ぶことができます。私がmydomain.com/myfeature/に行くと、htaccessがmydomain.com/index.php/myfeatureを指し示すようにしたいと思います。これはSymphonyによって実行されます。

私の現在の.htaccessファイルの外観は次のとおりです。

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    # we skip all files with .something 
    RewriteCond %{REQUEST_URI} \..+$ 
    RewriteCond %{REQUEST_URI} !\.html$ 
    RewriteCond %{REQUEST_URI} !\.php 
    #RewriteCond %{REQUEST_URI} !\.php 
    RewriteRule .* - [L] 

    # we check if the .html version is here (caching) 
    RewriteRule ^$ /index.html [QSA] 
    RewriteRule ^([^.]+)$ /$1.html [QSA] 
    RewriteCond %{REQUEST_FILENAME} !-f 

    # no, so we redirect to our front web controller 
    RewriteRule ^(.*)$ /index.php [QSA,L] 

    # hidden frontoffice controller 
    RewriteRule ^index\.php/(.*)$ /index.php [QSA,L] 
    # fo controllers 
    RewriteRule ^frontend\.php/(.*)$ /frontend.php [QSA,L] 
    RewriteRule ^frontend_dev\.php/(.*)$ /frontend_dev.php [QSA,L] 
</IfModule> 

あなたが行くここであなた

+0

symfonyは一般に、ApacheのVirtualHostセットアップでベンダーのWebコンテンツに少なくとも1つの 'Alias'を定義しています - このページの[Webサーバーの設定](http://www.symfony-project.org/gentle-導入/ 1_4/en/03-Running-Symfony) - あなたのサイトはそんな設定ですか?もしそうなら、WordPressのレベルで同様のエイリアスを追加することは可能でしょうか? SymfonyとWordPressの.htaccessルールを混ぜ合わせて一致させる必要がなくなります。 –

答えて

2

でそれを残しました。

私はこれが他のルートのすべてが通常通りアクセスすることを可能にするが、ブログのルートが残っている

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !/blog -------Add this condition to by pass the rewrite rules 
RewriteRule ^(.*)$ app.php [QSA,L] 

、メインのWebフォルダにブログをinstalleと、以下のように.htaccessが設定された

//Added to the autoload.php 
require('../vendor/wordpress/wp-blog-header.php'); 

手付かずで直接ワードプレスに渡されます。 WordPressデータベースから物事を引き出すために、私はsymfonyのコントローラでwordpressメソッドを呼び出し、それを私の小枝テンプレートに渡すことができました。

$posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); 
return array('posts'=>$posts); 

私は、これはあなたが求めている正確に何であるかどうかわからないのですが、それはどのように私のワードプレスのブログやsymfonyの共存2.0サイト。私はwordpressテンプレートとSymfonyテンプレートを更新しておく必要がありますが、本当に苦しいです。私は本当に、これらを素晴らしいツールにまとめようとするより良い解決策を考え出すことができればと思います。

2

ありがとうございます。私はワードプレスのコントローラライン以下のものがこれまでに到達することになるとは思わないが、私は以下を使用して、私のsymfonyのサイトとwordpressのブログを統合し、とにかく

<IfModule mod_rewrite.c> 
RewriteEngine On 

# we skip all files with .something 
RewriteCond %{REQUEST_URI} ..+$ 
RewriteCond %{REQUEST_URI} !.html$ 
RewriteCond %{REQUEST_URI} !.php 
#RewriteCond %{REQUEST_URI} !.php 
RewriteRule .* - [L] 

# we check if the .html version is here (caching). If yes, don't redirect 
RewriteRule ^$ /index.html [QSA] 
RewriteRule ^([^.]+)$ /$1.html [QSA] 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule .* - [L] 

# if the 'myfeature' prefix is there, redirect to Symfony controller 
RewriteCond %{REQUEST_URI} ^/myfeature/ 
RewriteRule .* index.php [QSA,L] 

# otherwise, redirect to wordpress controller 
RewriteRule .* wordpress/index.php [QSA,L] 

# hidden frontoffice controller 
RewriteRule ^index.php/(.*)$ /index.php [QSA,L] 
# fo controllers 
RewriteRule ^frontend.php/(.*)$ /frontend.php [QSA,L] 
RewriteRule ^frontend_dev.php/(.*)$ /frontend_dev.php [QSA,L] 
</IfModule> 
関連する問題