Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
You could ask this at wordpress stackexchange website =) –  Olivier Pons Jan 27 '12 at 7:37

1 Answer 1

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.

share|improve this answer
    
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. –  Jack Hayter Jan 10 '12 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 '12 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 –  Jack Hayter Jan 11 '12 at 0:13

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.