Forum Moderators: phranque
but, when clicking on a link from within mysite.com, .htaccess always returns a "notice" page.
Here's what's in my .htaccess file..
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^www.mysite.com/ [NC]
RewriteRule .* [mysite.com...]
I am brand new to this, and butting up against a deadline..Anyone have any suggestions?
Welcome to WebmasterWorld [webmasterworld.com]!
You'll have a problem with users having blank referrers being unable to see anything but your notice page. Internet security software and caching proxies between you and your visitor may drop the referrer, and the visitor may well be unaware of it, thus making your site look 'broken'.
I would suggest using cookies instead, but nothing is bullet-proof. Some visitors may have cookies disabled as well.
You could also allow blank referrers, but then those users would bypass your "We're moving" page.
Have you considered using SSI to include a simple header on each page announcing the move? The header could contain a link to a page with all the details. Or do you have a checkout page, or some other page that most users end up going to eventually?
Just some ideas...
Jim
Nothing here is going to bat 1.000, I guess..
Seems like allowing the blank referers would be preferable to a broken site.
If I could just arrange this so that a customer following a link on "notice" could get on further into the site, that'd be pretty good. right now, even when I'm actually in the site, clicking a link to a page which is contained in the directory that also contains the .htaccess file returns the "notice". It is not allowing a visit from within the site.
I am not yet familiar with SSI, though I guess I could learn..
Also not sure how to use cookies..
I had seen a thread on WebmasterWorld with some code such that once a visitor had seen a page, it would set a cookie and he'd not have to see the same page again on a return visit..that sounds kind of complex for me right now..
I could change a picture that's called for on each page to ask a visitor to look at the new location for the biz, but honestly, I don't trust visitors to "click here" on their own when it's this
important...hehe/
we don't have a "check out page"..customers make too many bad decisions to let them buy without a little consultation, so we require a phone call. our return rate is so close to zero it'd scare you!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^(www\.)?mysite\.com [NC]
RewriteCond %{REQUEST_URI} !^/notice\.html$
RewriteRule \.html$ http://www.mysite.com/notice.html [R=302,L]
Actually, I like your replace-the-common-image idea, and you might want to use both. If you are on a short fuse, there's no use risking a major technical problem with cookies or any other new technology right now.
Jim
<edit> Fixed typo </edit>
[edited by: jdMorgan at 4:34 am (utc) on Mar. 23, 2004]
So is it correct that once you type "http://", regex escape backslashes for the "." are not necessary/wrong? I haven't been able to find any clear rules on this...(low priority)
Thanks again for everything,
Chuck
The best source for mod_rewrite info is the Apache mod_rewrite [httpd.apache.org] documentation itself. It's a bit impenetrable at first, but if you have an existing, working RewriteRule, you can dig through the RewriteRule and RewriteCond documentation and figure out how it works.
Jim
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_HOST}!^(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} .*
RewriteCond %{HTTP_REFERER}!^(www\.)?mysite\.com [NC]
RewriteCond %{REQUEST_URL}!^(www\.)mysite\.com/notice\.html$
RewriteRule \.html$ [mysite.com...] [R,L]
thanks,
Chuck
No, this is not quite right. when I follow links from the notice page and try to get back to a product description page, I am still being redirected to the notice. Being in the site doesn't exclude me from the redirect back to the notice.I wind up in a loop .(hope this is clear..)
The code we developed above is intended to do what you want, but something is just not quite right. Since I don't have access to all of your test results, I'm afraid I can't tell why it does not work - This is very "standard" code for a very "standard" application. I encourage you to keep testing and tweaking the code - at the very least you will begin to understand how it works, and that will undoubtedly help you find a solution.
Jim
Yes, the code says, "If the referrer is non-blank and is not our own site, and the requested URI is not the notice.html redirect page, then redirect all requests for html files to the notice.html page."
I just spotted another "typo" in the code I posted - a rather large error. The first three lines should be RewriteCond directives, followed by a single RewriteRule. See the amended post (msg #4) above.
Jim