2

I made the mistake of adding a 301 Redirect to my .htaccess file when I didn't want the redirect to be permanent. So, my question is, how can I remove the redirect now? Simply removing the code from the .htaccess file didn't work. I've tried going to the URL on multiple browsers after refreshing the cache multiple times and it still redirects.

I have also tried replacing the 301 redirect with a different URL to see if it would atleast update the page, but that didn't work.

This is the code that was on the .htaccess file before:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^redirectURL.*$ http://www.website.com/ [R=301,L]

This is what I've tried to change it to:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteRule ^differentRedirect/? http://www.othersite.com/ [R=302,NC,L]

Is something wrong with the syntax or is the real problem that I used a permanent redirect?

After doing a curl -I on the site I get the following:

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 06 May 2014 03:13:12 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 343
Connection: keep-alive
Keep-Alive: timeout=15
Location: http://www.website.com
Cache-Control: max-age=86400
Expires: Wed, 07 May 2014 03:13:12 GMT
Vary: Accept-Encoding

Does that mean after Wednesday, 7 May it will no longer redirect???

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
neuquen
  • 3,991
  • 15
  • 58
  • 78
  • Are you sure you are editing the correct file? Did you clear your browser cache? What happens when you do a `curl -I` for the URL in question like `curl -I http://www.foo.bar/differentRedirect/`? What are the headers that show up? – Giacomo1968 May 06 '14 at 03:03
  • Remember to clear your browser cache. Sounds like its your browser still having the same .htaccess and not reading the new one. – Kyle Yeo May 06 '14 at 03:04
  • I'm doing a hard refresh, and I've tried multiple different browsers, and have tried going incognito on all three. I know it's not the browser cache. Is the server doing some caching???? It uses NginX I think. – neuquen May 06 '14 at 03:05
  • 1
    @JakeGould See updated question with curl -I – neuquen May 06 '14 at 03:16
  • Maybe [this answer](http://stackoverflow.com/a/13116771/1370722) could help? – Aurélien Gasser May 06 '14 at 03:40
  • “Does that mean after Wednesday, 7 May it will no longer redirect???” That is just a cache expiration that all web content has. In your case while you seem to indicate you are using Apache, the link that Aurélien Gasser provides shows similar behavior for Nginx. So perhaps you have Nginx running & something needs to be reconfigured? – Giacomo1968 May 06 '14 at 13:51

1 Answers1

1

So... funny story....

Apparently my web host just barely decided to migrate all of my content to a new server. I didn't realize this and so I was editing the .htaccess file from the old server. Once I changed the .htaccess file on the new server, everything worked great.

So, one thing that can be learned from this is, even if you do have NGINX, the .htaccess file is still vital and can still be used for server configuration.

I also decided to use the easier syntax below for my now TEMPORARY redirect:

Redirect 302 /page http://www.example.com/
SoftwareCarpenter
  • 3,835
  • 3
  • 25
  • 37
neuquen
  • 3,991
  • 15
  • 58
  • 78