Hi,

I am new to drupal and this is my first site. I installed drupal in a subdirectory /drupal which is an addon domain. I am able to access the website with http://www.mysite.com with correct DNS configutaion.

The site in general works fine with just that I am not able to add any new views. Whenever I try to add a new view I get the following error "An HTTP error 0 occurred.
http://mysite.com/admin/views/ajax/autocomplete/tag" as soon as I enter anything in "View tag: ". If I proceed to the next step by clicking "OK" I am not able to add any field to the view.

When I tried to use firebug to actually see what is going on with the ajax I found this.

Response Headers:

HTTP/1.1 301 Moved Permanently
Date: Tue, 23 Mar 2010 07:50:48 GMT
Server: Apache/2.2.14
Location: http://www.experts-linked.com/admin/views/ajax/autocomplete/tag/list
Cache-Control: max-age=1
Expires: Tue, 23 Mar 2010 07:50:49 GMT
Content-Length: 351
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

Request Headers:

OPTIONS /admin/views/ajax/autocomplete/tag/list HTTP/1.1
Host: experts-linked.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Origin: http://www.experts-linked.com
Access-Control-Request-Method: GET
Access-Control-Request-Headers: x-requested-with

From above it seemed that I am getting a 301 error which says Moved Permanently. I made some changes to the .htaccess file to see if it makes difference. Following are the changes:

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase / <----------- uncommented this

This change did not make much difference.

I believe that the problem is ajax calling "/admin/views/ajax/autocomplete/tag/list" instead of "http://www.experts-linked.com/admin/views/ajax/autocomplete/tag/list"

Is there anything that I am missing.

Please help me fix this thing. I have tried all my options. I am also new to web development and alien to PHP.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Well, the autocomplete javascript is actually a core functionality, it just happens to be a Views path that it's trying to get to. So I'm not sure how much help I can be here.

The first thing I would try is to hit the URL it's trying to visit with your browser. What do you get? Sometimes some web servers interfere with admin paths.

It also looks like you might be having issues with something trying to redirect from mysite.com to www.mysite.com -- it's possible you need to adjust your settings.php to ensure that www.mysite.com is the actual base URL.

kandalam’s picture

Thanks a lot. I had looked at the settings.php but clearly missed the base URL. I have corrected the base URL to point to http://www.mysite.com earlier it was http://mysite.com.

Views has started working after this.

Thanks a lot again. I was so stuck with it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

doublewhopper’s picture

I have the same issue, but the my settings.php contains

 $base_url = 'http://our_subdomain.maindomain.com/drupalwebsite';  // NO trailing slash!

The site is part of a multisite setup and I am using View 2.6.

I can create the view and the displays work fine on the frontend side, but still I am curious about the error message. It might cause problems that I cant anticipate at the moment.

Thanks for helping out.

Cheers

protoplasm’s picture

Wow. Somehow I managed to overwrite my old .htaccess with a new install copy and because the rewrite base url wasn't setup, I kept getting this error above. Fixing that, fixed the views issue. Thanks for this post.

Michael3185’s picture

Version: 6.x-2.8 » 6.x-3.0-alpha3

Just wanted to say thanks for these posts. I was going nuts trying to find out why Views was throwing an Ajax 'Error 0', and found that I'd set the Base URL, but then later used .htaccess to remove the www from my site's URL (301 redirect). Making the URL exactly the same (ie., without www) fixed Views.

mry4n’s picture

I had a similar issue, due to the base url, but my situation was a little different.

I'm set up on a subdomain like sub.mysite.com, but the default on my web host is to tack www on the front of all that so it looks like www.sub.mysite.com. All of the site works fine, except for this. When I changed my base url to http://www.sub.mysite.com the error message went away.

tree2009’s picture

Hi, here is detail analysis and solution about this error: solution to An error accured at… Error Description:0

benjarlett’s picture

My base URL was set to http://www.mysite.com in settings.php

Even simpler solution to me,... for some reason I was browsing the views page without the www. simply changing the url adding the www sorted it. Did confuse me for some time though.

mennonot’s picture

benjarlett's solution of adding the www in the address bar fixed this error for me.