laravel和wordpress在同一个域中(laravel在子文件夹中) [英] laravel and wordpress on the same domain(laravel in subfolder)
问题描述
我有wordpress和laravel应用,应该使用AJAX进行通信,因此它们必须位于同一域中.
I i have wordpress and laravel app, that should communicate by using AJAX- so they must be on the same domain.
wordpress网站应位于主域-MYdomain.com上. 而我的laravel应用程序位于MYdomain.com/panel上.
wordpress site should be on the main domain - MYdomain.com. and my laravel app to be on MYdomain.com/panel .
wordpress .htaccess:
wordpress .htaccess :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond ! ^panel
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
laravel htaccess(mydomain.com/panel)
laravel htaccess(mydomain.com/panel)
<IfModule mod_rewrite.c>
RewriteCond ^panel
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
我收到内部服务器错误 apache2文件夹中的日志为:
i get Internal Server Error and the log from apache2 folder is:
[Thu Mar 12 15:31:07.596263 2015] [core:alert] [pid 1172] [client xxx.xxx.xxx.xxx:52628] /var/www/panel/.htaccess: </IfModule> without matching <IfModule> section
如何解决?
谢谢!
推荐答案
您的主要.htaccess就是这样.
Your main .htaccess like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/panel [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
在面板文件夹中,将您的规则更改为这样.
In the panel folder change your rules to be like this.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /panel/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
这篇关于laravel和wordpress在同一个域中(laravel在子文件夹中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!