0

I'm trying to redirect all pages to a blog post at URL example.com/big-changes-for-2013/ (including trailing slash)

I do not want to redirect me, because I'm working on the rest of the site. This is what I have so far (this is a .htaccess redirect):

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/big-changes-for-2013/$ 
RewriteCond %{REMOTE_ADDR} !^50\.137\.88\.129
RewriteRule $ /big-changes-for-2013/$ [R=302,L] 

The part preventing me from being redirected works. The part thats not working is the redirect itself, which is an infinite loop.

The code above is based off of a combination of this and this.

Any ideas?

Community
  • 1
  • 1
Chris
  • 1,881
  • 3
  • 20
  • 27

2 Answers2

0

Try

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^50\.137\.88\.129
RewriteRule ^(?!big-changes-for-2013/$) /big-changes-for-2013/$ [R=302,L] 

The rule regexp is what is a called a negative look-ahead assertion. It means "match anything other than big-changes-for-2013/$".

TerryE
  • 10,724
  • 5
  • 26
  • 48
0

Solved with:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REMOTE_ADDR} !^50\.137\.88\.129
RewriteCond %{REQUEST_URI} !^/(big-changes-for-2013/)
RewriteRule ^(.*) /big-changes-for-2013/ [L,R=301]
</IfModule>
Chris
  • 1,881
  • 3
  • 20
  • 27