Question

I have Magento, Wordpress, and Fishpig installed and running and everything is working well. But for SEO purposes, we need:

#'catname' is short for a wordpress category name

www.magentosite.com/catname

to silently redirect to...

#'wpurl' is the wordpress sub-directory
#set to serve the wordpress instance 
#this is NOT the wordpress installation directory

www.magentosite.com/wpurl/.../catname

We've tried modifying the .htaccess but the following rewrite rule returns a 404 from Magento.

RewriteRule ^catname$ ^wpurl/.../catname$ [L]

The following RewriteRule did work, but it did not redirect silently, which we need.

RewriteRule http://www.magentosite.com/catname http://www.magentosite.com/wpurl/.../catname

We currently have the fishpig wordpress environment set to integrated. Any ideas?

Was it helpful?

Solution

If you want to remove the /blog/category/ portion from your category URL's, first install the WP No Category Base plugin in WordPress, which will remove the /category/ from your URL.

Next, to remove the /blog/ portion from your URL's, you will need Root.

To configure root, first make sure you have the latest version of Magento WordPress Integration installed and then install Root. Login to your Magento Admin and select WordPress > Settings > Integration and set 'Integrate at Root' to 'Yes' and 'Replace Homepage with WordPress' to 'No' (screenshot below).

Integration settings

Next, login to your WordPress Admin and create a page called 'Blog' with a page slug of 'blog'. Set Appearance > Customize > Static Front Page to 'A static page' and set the front page to be empty and your posts page to be the page named Blog, which you just created (screenshot below). Then hit save.

WP Theme Customisation Settings for Root

Your blog homepage will now be visible from the /blog/ URL just as before, however all of your other blog URL's will be available from the root. If you want your blog posts to be available from /blog/, go to your permalink settings in WordPress and add /blog/ to the start of your custom permalink.

OTHER TIPS

The rewrite rule's target must be a URL or file path, ^wpurl/.../catname$ is not a valid path, unless you actually have a foldername that starts with ^ and your category name actually ends with a $, both of which will end up getting encoded. Try:

RewriteRule ^catname$ /wpurl/.../catname [L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top