laravel and wordpress on the same domain(laravel in subfolder)

我们两清 提交于 2019-12-10 11:07:49

问题


I i have wordpress and laravel app, that should communicate by using AJAX- so they must be on the same domain.

wordpress site should be on the main domain - MYdomain.com. and my laravel app to be on MYdomain.com/panel .

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)

<IfModule mod_rewrite.c>
RewriteCond ^panel
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>  

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

how to solve it?

Thanks!!


回答1:


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>  


来源:https://stackoverflow.com/questions/29018742/laravel-and-wordpress-on-the-same-domainlaravel-in-subfolder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!