0

This problem is driving me nuts. I've tried reading loads of tutorials about how to use mod_rewrite but I just can't get my head around it.

These questions must get asked all the time, so apologies for looking like a dumb***.

My problem is this. I need to remap several request URLs to my wordpress installation. Wordpress also uses mod_rewrite... does chaining work properly? The rewrites I need to make are:

  • example.com -> example.com/site
  • example.com/blog -> exaple.com/site/categories/blogposts
  • example.com/site/blog -> exaple.com/sites/categories/blogposts

Ideally I would like to remap the URLs rather than perform a redirect, but could put up with it if there is no other solution.

1
  • You could ask this at wordpress stackexchange website =) Jan 27, 2012 at 7:37

1 Answer 1

2
RewriteRule ^$ /site
RewriteRule ^blog$ /site/categories/blogposts
RewriteRule ^site/blog$ /sites/categories/blogposts

Mind you it will only work for those exact urls. You can add wildcards to those three there to allow other urls revolving around those patterns.

3
  • Thanks for your reply. Unfortunately I don't seem to be having a whole lot of luck with these. The first rule does indeed redirect to /site. The second rule results in my custom 404 page being displayed, and the third rule results in the Wordpress 404 page being served. Jan 10, 2012 at 23:57
  • Are they the exact urls you are trying to use? Not something like /blog/xyz? Also check your error log and see if that has any information.
    – Nick
    Jan 11, 2012 at 0:00
  • They were definitely the URLs I wanted to access, however my error log is full of these: [error] [client <<IP>>] File does not exist: /home/<<ME>>/public_html/blog. I have, however found a partial resolution thanks to this article: codex.wordpress.org/Giving_WordPress_Its_Own_Directory which helped me remove the '/site' section of my URLs Jan 11, 2012 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .