Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've almost completed the tedious task of migrating a relatively complex Joomla site over to Wordpress.

The (more or less) final stage I am wishing to figure out is the 301 redirections. I've spent the past few hours researching this topic, but I've not found any tips specific to my situation (particular the sub-directory structure). I'd greatly appreciate some hand-holding. I don't wish to mess this up because I realise it could impact the hundreds of incoming links from search engines.

Here's the background information:

  • Joomla was installed in www.domain.com/site/

  • Wordpress has been installed in domain.com/wordpress/

  • All Joomla articles were migrated to Wordpress installation, and post IDs were maintained.

  • Joomla URI permalink structure for articles is: www.domain.com/site/YYYYMMDD###/...

    e.g. www.domain.com/site/20110623398/articles/category-slug/article-slug.html

    The ### is the unique ID of the article on Joomla (aka post ID).

  • The posts in Wordpress have the same unique ID. Thus www.domain.com/site/20110623398/articles/category-slug/article-slug.html can be redirected to domain.com/?p=398

  • There are a few other URI structures I'll need to handle. But I will address that once I have the redirection of the articles figured out.


  1. How do I set up the .htaccess file so that all incoming links to joomla articles have the unique ID extracted and then redirect to /?p=UID (as a 301 redirect)?

  2. How do I do this in such a way that the site will always use or display domain.com/ as the home directory (with and without the www), whilst keeping the site located in /wordpress (or in /site, if that works better for the redirects - which I suspect it will).

    I don't, however, want the site to ever load up and show a /wordpress/post-name-etc/ type URI (or /site/post-name-etc/ URI). Meaning I want the /wordpress/ or /site/ part to always be removed from the end user point of view (including search engines).

    I believe the .htaccess file is also used for this.

  3. Along with many other sites and posts, I have read the info related to Giving Wordpress It's Own Directory on the WordPress Codex.

    Point #4 on that article says, "Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address).", but I have a .htaccess file in the root already, and it has lots of code in it.

    Is it okay to just copy the index.php and not the WP htaccess file?

Points (2), combined with (1), is where I came a bit unstuck. Getting all the articles on domain.com/site/ to redirect to domain.com/, and for the correct page to come in from domain.com/wordpress without displaying the /wordpress/ part.

As mentioned above, I suspect it may be best if I move the wordpress site to domain.com/site (and change it's configuration file home directory settings accordingly).

share|improve this question
Welcome to WPSE :) As we take our time to read this: Please go back and format your question properly. Thanks. –  kaiser Jul 4 '12 at 22:33
Thank you Kaiser. As you consider my question to be improperly formated, I looked through the FAQ to see if there were specific question protocols detailed there. I did not find any. Would you kindly point out to me how I might find out the proper way to format a question here? Thanks. P.S. I have reworded the question title to make it clearer, but I suspect that's not what you were referring to as an improper question format. –  inspiredlife Jul 5 '12 at 1:54
n/p Just use the quicktags you got in the WYSIWG editor: Links, code formatting, etc. –  kaiser Jul 5 '12 at 2:42
@inspiredlife Do NOT paste links as it is. Use anchor text (text links). That's an example. No one READS links right? That's the simple way of making your question more readable. Also you can wrap those URL structures you mentioned, in code tags (use Ctrl/Cmd + K ) so that they appear neater like so: www.domain.com/site/YYYYMMDD###/ –  its_me Jul 5 '12 at 4:07
@AahanKrish - Thanks. Done. I agree, it's easier to read and looks neater. –  inspiredlife Jul 5 '12 at 4:17
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.