-2

I have searched and found solutions that were close, but I have not found anything that is exactly what I'm looking for. I have a two page/step form. I would like all external traffic pointing to page two to be redirected to page one of the form. However, traffic from page one needs to get to page two without being redirected back to page one.

Thanks!

  • 1
    It's unclear what you're asking. See [How to Ask](http://stackoverflow.com/help/how-to-ask). – vvanasten May 10 '14 at 14:45
  • @pintxo apache redirect based on referrer seems like a great idea... how ever I can not account for all referring sites. I haven't seen a good example of preventing all referrers except for my site. The closest example I've seen is trying to modify a image hot link prevention like this -> http://httpd.apache.org/docs/2.2/rewrite/access.html – zaggstudios May 10 '14 at 15:00
  • Well, as I understood your problem there is one valid referrer and all others should be redirected. So simply negate the RewriteCond? See http://stackoverflow.com/questions/4824964/rewritecond-in-htaccess-with-negated-regex-condition-doesnt-work for an example. – pintxo May 10 '14 at 15:04

1 Answers1

0

Something like this should work for you:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://example.com [NC]
RewriteRule ^form/page2.php$ http://example..com/form/page1.php [L,R]

Going to http://example.com/form/page2.php will redirect you to http://example.com/form/page1.php unless you are linked to page2.php from within site.com.

Howli
  • 12,291
  • 19
  • 47
  • 72