Tried to google it found no solution. I get the error "400 bad request" on a live server with the "www".domain without it (like: domain.com), it does work, it caches and serves aswell. on localhost there is no problem. Tried with RewriteBase / doesn't work. Tried every option with .htaccess its the same. Easy to reproduce.
log: Invalid URI in request GET / HTTP/1.1

Comments

Anonymous’s picture

So http://localhost works, http://example.com works, but http://www.example.com doesn't ? I would check the lines

  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

from the standard Drupal .htaccess file and see that they are correct (download a new copy if necessary), as 400 is a syntax error which could be caused be an incorrect rewrite rule you may want to use firebug on firefox or chrome to examine the headers sent and received to see if there is a redirect header (code 301) sent when you type in www.example.com and does the address in the browser bar change ?

Anonymous’s picture

In firebug you should have a request header for the index page like this

GET / HTTP/1.1
Host: www.google.com

clearly stating the requested domain and / as the root, you may need to click on the tabs HTML, Headers, View Source (by request headers) if you are redirected first then it should similarly tell you the source and destination.

larsjohnson’s picture

yes this should work you are right thanks maybe its better to redirect from the point of seo aswell

Anonymous’s picture

Status: Active » Closed (works as designed)