Forum Moderators: phranque
I face a really particular problem as I have a site that returns 403 errors for some places/IP while returning 200 status code for most of my visitors.
I could see this issue as using the seo tool from <snip> to check the server headers I get a 403 status code, while for the same page I can access it with no problem and obviously all my actual visitors do too.
This problem occurs for nearly all my pages and I could figure out that only non-rewrited pages do not return a 403 in the tool.
htaccess could be the file that cause the problem but, I use the same htaccess file and rewrite rules for all my sites and only this one site has a problem.
I also checked the httpd.conf but no "deny" access is specified for this site.
Is there someone that already faced this kind of problem or that know what could be the cause of it ?
Many thanks by advance if you can help.
the url of the site is
<snip>
[edited by: jdMorgan at 9:28 pm (utc) on July 19, 2008]
[edit reason] No domains or tool sites, please. See Terms of Service. [/edit]
Sorry for the urls, so here is the htaccess file :
RewriteEngine On
Options +FollowSymlinksRewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]
RewriteRule ^sitemap\.xml?$spip.php?page=sitemap [QSA,L]
AddType text/x-component .htc
RewriteRule ^(.*/)?\.svn/ - [F]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule "." - [skip=100]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule "." - [skip=100]
RewriteRule ^\+-[^/\.]+(-\+)?(\.html)?$spip.php?page=mot [QSA,E=url_propre:$0,L]
RewriteRule ^\+[^/\.]+\+?(\.html)?$ spip.php?page=breve [QSA,E=url_propre:$0,L]
RewriteRule ^-[^/\.]+-?(\.html)?$spip.php?page=rubrique [QSA,E=url_propre:$0,L]
RewriteRule ^_[^/\.]+_?(\.html)?$spip.php?page=auteur [QSA,E=url_propre:$0,L]
RewriteRule ^@[^/\.]+@?(\.html)?$spip.php?page=site [QSA,E=url_propre:$0,L]
RewriteRule ^[^/\.]+(\.html)?$spip.php?page=article [QSA,E=url_propre:$0,L]
URLs look like this :
example.com/my-rewrited-url.html or,
example.com/-my-rewrited-url-.html
When url's are accessed from certain ranges of IP's I get a 403 response server while accessed from other IP's I have a 200.
(My statistic script gives me visitors from more than 120 countries)
The httpd.conf file is the original one with no particular mods no specific "deny" have been made in the conf file and many other sites hosted on the same server will work properly using the exact same htaccess while this one don't...
But one very strange thing that makes me think it has to be related to a htaccess file is that when I ask the url not rewrited I don't have any 403 issue. Or could it be an other problem ?
(Maybe a file hosted on an other server called by my pages or by a script called by my pages, that would return a 403 for some IP ranges ?)
I'm actually running out of ideas :(
Many thanks by advance if you have any ideas
[edited by: jdMorgan at 11:17 pm (utc) on July 19, 2008]
[edit reason] Please use example.com -- 2nd request. [/edit]
The only rule which can generate a 403-Forbidden response directly is the second one -- and only if the URL contains ".svn/"
There is no explanation for the rules with patterns requiring URL-paths to start with "+" or "@" characters... If you have no such URLs, then simplify the code by eliminating these rules. Otherwise, please explain what these rules are for.
Please see the edit notices on your first two posts.
Thanks,
Jim
I'm confused I missed the urls in the htaccess file I copy-pasted :(
For spaces it's actually a problem with the display, lines should all appear like this one :
RewriteRule ^\+-[^/\.]+(-\+)?(\.html)?$ spip.php?page=mot [QSA,E=url_propre:$0,L]
The svn line of code is actually not involved, it still generate 403 if not in htaccess file.
For the pattern of urls such as :
+name-of-file+.html
_name-of-file_.html
@name-of-file@.html
it's the pattern to make the difference between the php files called and I think that the flag : E=url_propre:$0 will call a php file that makes the query to the database to find the matching ID's of elements to display where "name-of-file" is stocked in the DB.
The most curious thing is that if error doesn't come from the htaccess, how come it be possible that the "non-rewrited" urls for the exact same pages will not return any 403 (in case I deactivate the htaccess)...
$0 is invalid. Use $1 through $9 to back-reference the matched contents of the first through ninth parenthesized sub-patterns.
What happens if you type "http://example.com/spip.php?page-mot" directly in your browser's address bar? (This may not work completely, because your "url_propre" variable won't get set, but it may still provide useful information.)
The regular-expressions patterns need some improvement, but that is not critical at this time. I strongly recommend that you fix the "$0 problem" first.
Jim