| :: |
| Author |
Message |
kidneybean
Joined: 15 Aug 2008 Posts: 3
|
Posted: Fri Aug 15, 2008 7:08 pm Post subject: htaccess rewrite rule works but throws errors. |
|
|
From the perspective of someone visiting my site, the rewrite rule works fine, but meanwhile the server throws errors.
Here's the rule:
| Code: | | RewriteRule ^Other-Question/Ok-an-important-Olympic-Games-question/Q([a-zA-Z0-9]+)/F([0-9]+)$ Answers_Display.php?q=$1&format=$2 |
And here is the error:
| Code: | | www.myserver.com [Fri Aug 15 14:39:53 2008] [error] [client 70.23.83.149] File does not exist: /usr/www/users/moi/Stage/Other-Question, referer: http://myserver.com/Other-Question/Ok-an-important-Olympic-Games-question/Qv8bkjpqgjx/F5 |
Any clues?
Thanks. |
|
|
| Back to top |
|
 |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3987
|
Posted: Sat Aug 16, 2008 9:08 am Post subject: Re: htaccess rewrite rule works but throws errors. |
|
|
Interesting.
Have you checked if the server was now throwing a 404 header while it still displays the page ?
Anyway, you can try to add :
| Code: | RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d |
Before the rewriterule, this should make so the server will first make sure that the file / dir does not exist before it will run it, and could fix the issue you're facing. |
_________________ phpBB SEO || SEO Forum || Forum Référencement
GYM Sitemap & RSS for phpBB3 has been released ! || GYM Sitemap & RSS for phpBB3 est disponible ! |
|
| Back to top |
|
 |
kidneybean
Joined: 15 Aug 2008 Posts: 3
|
Posted: Mon Aug 18, 2008 5:48 pm Post subject: still looking for clues! |
|
|
Thanks, SeO.
The server doesn't throw a 404 header while it still displays the page.
I tried adding those two RewriteCond lines you suggested but I still get the same error.
Any other ideas? I'm desperate for things to try!
Thanks again. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
Posted: Sat Aug 23, 2008 7:28 am Post subject: Re: htaccess rewrite rule works but throws errors. |
|
|
From the logs the error is on Other-Question/, a bot (they do such tests) or someone may just have tried to load what appears to be a dir, and fall on a genuine 404.
For this rewriterule only (could not work with other if any), you could redirect this type of calls to root like this :
| Code: | RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+/)?[a-z0-9]+/?$ / [L,NC,R=301] |
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
kidneybean
Joined: 15 Aug 2008 Posts: 3
|
Posted: Tue Sep 02, 2008 3:00 pm Post subject: still searching for clues |
|
|
Thanks, I tried adding
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+/)?[a-z0-9]+/?$ / [L,NC,R=301]
but I got the same error!
let me know if you can think of anything else to try.
thanks so much. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
Posted: Sat Sep 06, 2008 8:41 am Post subject: Re: htaccess rewrite rule works but throws errors. |
|
|
Is it redirecting Other-Question/ to domain's root ?
You can as well try :
| Code: | RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-z0-9]+(/[a-z0-9]+)?/?$ / [L,NC,R=301] |
or event :
| Code: | RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-z0-9]+(/[a-z0-9]+)?/?$ http://www.example.com/ [L,NC,R=301] |
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
mnl-joshua
Joined: 29 Sep 2008 Posts: 1
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15242
|
Posted: Sat Oct 04, 2008 8:39 am Post subject: Re: htaccess rewrite rule works but throws errors. |
|
|
mm, I get a 200 on both examples.
You could still try to use :
| Code: | RewriteRule ^venue(/([a-z0-9-]+))?/?$ /venue.php?v_slug=$2 [NC,L]
RewriteRule ^venues(/([a-z0-9-]+))?/?$ /directory.php?c_slug=$2 [NC,L] |
Less rewriterules for the same usage, and more efficient with the L flag, which will prevent the eventual following rewriterules to be tested after one of these two matched.
NC flag stand for no case, and make the A-Z part useless in the character class.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
|
|