Forum Moderators: phranque

Message Too Old, No Replies

Help needed with rewrite

         

rsdesigner

1:30 pm on Jul 13, 2011 (gmt 0)

10+ Year Member



I have recently completed a website that worked without problem on all platforms. Almost all pages use a rewrite rule for the url. Today I find that my once working site is now not working on the mac platform. Here's the problem, if I go to:
[the-books-man.co.uk...]
from my mac browser I get a completely blank screen (no errors, nothing), on a pc the page displays fine, this url however:
[the-books-man.co.uk...]
displays fine on both mac and pc.
The rewrite rule I am using is
RewriteRule ^display/([^/]+)/([0-9]+)\.html$ display.php?nav=$2
I was under the impression that the htaccess rewrite was performed server-side so I'm a tad confused.
I am at a loss and would be most grateful to anyone who could shed some light on the problem.
Many thanks in advance.

lucy24

8:37 pm on Jul 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



if I go to:
{link}
from my mac browser I get a completely blank screen (no errors, nothing)

I tried it with Camino, Safari and Opera-- covering the basic three browser "families"-- and it worked fine, both with your link as given and with a manually rewritten link. So either you changed something after posting, or there's another variable.

g1smd

9:37 pm on Jul 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change the expires header to give immediate expiry, clear the cache and check using the Live HTTP Headers extension and others.

mod_rewrite does work server-side, so unless there are extra conditions that detect user-agent, remote-address, or others then all users should see the same responses.

Make sure that EVERY rule uses the [L] flag otherwise you WILL get 'difficult to diagnose' errors.

You MUST also set up your rewrite and your PHP script to verify the text in $1 otherwise spammers can link to you with whatever keywords they like and your site will return "200 OK" for all of them.

rsdesigner

10:50 am on Jul 14, 2011 (gmt 0)

10+ Year Member



Thanks for these responses. I have added the [L] flag to each rule but it didn't resolve the problem. I also added the following php headers to the page:
header("Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, private, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Again didn't resolve the problem.
I manually cleared my browser cache and that fixed the problem temporarily, but if I click on a link to reload a page the problem returns. My main concern is that if I'm having difficulty I'm guessing others will also.

rsdesigner

11:57 am on Jul 14, 2011 (gmt 0)

10+ Year Member



To add a bit more info, if I test the problem pages in Safari I get a 'Safari can’t open the page “http://www.the-books-man.co.uk/display/gift-ideas/23.html” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.' error message.
I have found a few references to the same problem cropping up with a Wordpress update, again only a mac related problem, the htaccess files were mentioned but I found no resolve. Bizarrely on the same site I have a sub folder containing another htaccess rewrite file that functions without problem, it only appears to tbe a problem in the root directory.
Things like this remove any enjoyment from web developing, where do I start!

rsdesigner

8:19 am on Jul 15, 2011 (gmt 0)

10+ Year Member



OK I have resolved the problem, anyone experiencing the same problem may want to check this out. My antivirus software was the route of the problem (virusbarrier x6) when web treats are switched off the site runs without issue.

g1smd

9:10 am on Jul 15, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



web treats?