0 Replies - 1227 Views - Last Post: 10 April 2008 - 07:55 AM

#1 girasquid   User is offline

  • Barbarbar
  • member icon

Reputation: 109
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

.htaccess RewriteCond not firing

Posted 10 April 2008 - 07:55 AM

Hello, all.

I'm currently working on a website that has a blog and a forum, integrated into each other.

The blog is at website.com/blog, and the forum is at website.com/forums. I would like to write an .htaccess file so that if the URL a user is requesting does not start with 'forums', they will be redirected to the blog. This is what I have:
RewriteCond {REQUEST_URI} !^forums.*
RewriteRule /blog/{REQUEST_URI} [NC,L]


But when I go to test the site, the redirect does not appear to be working at all. Can anyone point out where I am going wrong?

Thanks,
Girasquid

edit: just to be clear, I want this to fire only when the word 'forums' is at the beginning of the URL - not if, for example, a user tries to visit something like website.com/blog/forums-are-dumb.

edit #2: I figured it out - I need to used %{REQUEST_URI} instead of just {REQUEST_URI} - but now I have a new problem. This is my rule:
RewriteCond %{REQUEST_URI} !^forums.*
RewriteRule /blog/%{REQUEST_URI} [NC,L]


And firefox dies with the message "Firefox has detected that the server is redirecting the request for this address in a way that will never complete". Does anyone know how to get the rewrite to stop after the rule has fired?

This post has been edited by girasquid: 10 April 2008 - 11:52 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1