I have Magento 2 and want to setup WordPress in a subfolder, so it will be accessed via magento2.url/blog
I know about Fishpig but for my situation, it will not work because WordPress site has a lot of custom post types which is not supported by FishPig integration by default.
Right now if I tried to access magento2.url/blog it shows a 404 error Magento 2 page.
I modified .htaccess in WordPress subfolder to this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
But it not helps and home page for WordPress still shows a 404 Magento 2 page. I think I need to modify .htaccess in Magento 2 but not really sure how.
3
Answers
As answered on https://magento.stackexchange.com/a/53757 you should install WordPress outside the Magento directory.
Despite of that, in your case you must edit Magento
.htaccess
because WP can’t be accessed wich explains the Magento 404 error.The .htaccess is irrelevant when integrating WordPress into Magento. This file only applies when accessing WordPress directly (ie. for a WordPress Admin request).
Here are basic installation instructions:
This is all you need to do to integrate WordPress at /blog.
The .htaccess file has no impact here, however you should change /blog/ to /wp/ in the .htaccess for WordPress. The correct value is:
For a full installation guide, see this link.
For case if using Apache.
add to .htaccess & pud/.htaccess following code
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
In folder pub create symbol link like
ln -s /var/html/blog /var/html/pub/blog