1
votes

I have done the Magento - Wordpress integration through fishpig plugin. The URL of my posts, pages etc have changed now (because fishpig puts additional /blog/ in the URL.

Before integration my wordpress url was like below.

http://www.abcdomain.com/post-name

Now they have changed to like below

http://www.abccomain.com/index.php/blog/post-name

I have removed the index.php through .htaccess, however, I want to remove the blog from the URL as well so that my URLs should remain as they were before the integration.

Is this something which can be done through .htaccess OR through modifying the magento code + .htaccess?

1
If you do that you'll probably go to a major breakdown of your Magento installation.vard
Hi - I think magento will still see the URL as abccomain.com/index.php/blog/post-name but .htaccess should be able to restructure the URL... for that matter ... there is a plugin available which exactly does this..fishpig.co.uk/magento/wordpress-integration/root .. any pointers or thoughts will be very helpful.Shaikh
Well it seems tricky to me, this is probably why there is a plugin for that: you should add some top level router that would analyze if the url you're trying to reach should be sent to Magento or Wordpress. That's probably what the plugin is doing. Let's say you're trying to reach /products/, how do you know without querying Wordpress that you need to display a WP page or a Magento category? Or you could of course add some rewrite rules, but you will have to do that for every post, which can be hard to keep up.vard
An other way I just thought would be to hook on wp_insert_post_data and add the rewrite rule from here in the main htaccess file. I guess this could work.vard

1 Answers

0
votes

Shaikh has it right. This can be done instantly and automatically by using the Root addon extension for Magento. There isn't any other way to achieve this so Root is your only option.

Simply install the add-on extension in Magento and the /blog/ will be removed from all WordPress URLs automatically. You will then want to change your WordPress 'home' URL so that it no longer contains '/blog'. You can do this by going to Settings > General in the WordPress Admin and removing '/blog' from the second URL on the page.