问题
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