1

I'm trying to use mod_rewrite to point the blog portion of a site to a blog site.

this is what I have to handle the normal stuff

RewriteRule ^(\w+)/?$ index.php?page=$1

This is what i'm trying to use for the blog site

RewriteRule ^blog/?$ http://url.to.my.blogger.site

but it's not working, when I go to site/blog it directs me to index.php?page=blog is there something I need to do to not do the second rewrite if the first is correct? like an if/else? sorry don't know much about mod_rewrite so any advice would be awesome.

also I noticed that if I try to do something like site/home everything works fine but if I attempt to hit site/home/ it puts all of my urls into the wrong context, for example my css and images don't get loaded correctly.

my full file is this

RewriteEngine on

RewriteRule ^blog/?$ remote/blog/uri/here

RewriteRule ^(\w+)/?$ index.php?page=$1

RewriteCond %{THE_REQUEST} index\.php
RewriteRule ^index\.php - [F]

and when i hit site/blog it still tries to serve index.php?page=blog, I'm guessing I have to break out of the code at some point? I couldn't find documentation on if/else statements

Brodie
  • 8,399
  • 8
  • 35
  • 55

1 Answers1

0

I needed to add flags to my RewriteRule lines so that the server wouldn't evaluate further. Changing them to be

RewriteRule ^/blog http://url.to.blog [L]

did the trick, the problem was that it was evaluating all the way down, seeing as I wasn't attempting to go to index the last valid rule to evaluate was the general rewrite rule.

Brodie
  • 8,399
  • 8
  • 35
  • 55
  • So after almost since 2 years you have fixed your problem? – Rahil Wazir Apr 21 '14 at 14:26
  • I was looking through all my unanswered questions and realized that I had solved this issue and decided to provide an answer. I figured that was better than just leaving it unanswered. I contemplating closing it, but was't sure if there was a duplicate or if this could help someone in the future. But yes, I realize that it was a bit of while without activity. – Brodie Apr 21 '14 at 14:30