Community & Support

.htaccess file is affecting my other websites on Godaddy

Hello,

My first website was build using Drupal, and is currently hosted through Godaddy http://engagebooks.ca. The website works fine, however I am running into difficulties with my other sites. I tried uploading a new website to my server on Godaddy, using iWeb, but I am getting a 500 Internal Server error when I go to the site. When I called Godaddy they said that it's my Drupal .htaccess file that is affecting my iWeb website. The new website will work if you enter http://mattycox.com/Matty_Cox/Welcome.html but not if you enter http://mattycox.com. When Godaddy deleted my .htaccess file, the iWeb website worked perfectly, but my Drupal site stopped working, so I asked them to put the .htaccess file back up. Godaddy said I would have to either edit my .htaccess file, or add a new .htaccess file to my iWeb website. I'm not sure how to do this, or if it's even possible? My only other option is to open a new hosting account for $6.99 a month, for my non-Drupal websites. And insight would be greatly appreciated.

Thanks,

Alexis

Comments

Not really, you don't need to

Not really, you don't need to pay for a new hosting account. Just upload this file (.htaccess file): http://vimal.me/default.htaccess to mattycox.com 's home directory or even into every non-drupal folder and change the name from default.htaccess to .htaccess.

If you are using FileZilla, go into the "Server" tab on the top and check the option: Force showing hidden files.
So that you see the .htaccess files. If this doesn't work (it should work, I'm 99% sure), write here again. I can help you out perfectly.

Still not working

Hi Vimal,

I've uploaded the new .htaccess file into the Mattycox.com home directory, and renamed it, but it still does not work...

By the way, I uploaded the

By the way, I uploaded the .htaccess file directly into the folder on Godaddy. I did not use iWeb to upload this file. Not sure if this info helps you?

Thanks for your help

Alright, I got you. You have

Alright, I got you. You have the file welcome.html for you site, right?

Look into the default.htaccess file I have provided (it's the htaccess file comes with drupal).

In the 25ish line you will see this:

# Set the default handler.
DirectoryIndex index.php

just change the line from DirectoryIndex index.php to DirectoryIndex welcome.html.

Or just add a # in front of the line DirectoryIndex index.php and change the welcome.html to index.html

And upload the file to mattycox.com and mattycox.com/Matty_Cox.

Let's see what happens next. BTW, do you have any index.php file in one of these folders? Because, when I point to your website some error is popping up. I can fix it in a minute if I know the way, you have your files.

Hi Vimal, Thanks for this. I

Hi Vimal,

Thanks for this.

I changed both .htaccess files, both ways, but I am still running into the same problem. However I did not change the .htaccess file that goes with the engagebooks.ca website.

I do have an index.html file in both the mattycox route folder and the matty_cox sub folder. This is the content in the index.html folder:

<?xml version="1.0" encoding="UTF-8"?>

After trying what you suggested, I went ahead and changed to folder name that the website points too, from /mattycox to /mattycox/matty_cox so now the website will work if you type in http://mattycox.com/Welcome.html or http://mattycox.com/index.html but http://mattycox.com will not work on its own.

Any ideas?

RewriteBase

Have you tried RewriteBase... (You might have already done this .. otherwise give it a try)

Inside your Matty_Cox directory, .htaccess should say

RewriteEngine On
RewriteBase /

I checked the .htaccess file

I checked the .htaccess file and it does contain what you suggest:

Here is the current .htaccess file for Mattycox in full:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.

# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.

# Set the default handler.
DirectoryIndex welcome.html

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [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 and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# 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 /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

And this is what the folders

And this is what the folders look like:

html (Folder)
_db_backups
cgi
css
dbboon
files
includes

mattycox (Folder)
Matty_Cox (Sub-Folder)
About_Me_files
Blog
Media
Photos_files
Scripts
Welcome_files

misc
modules
php_uploads
planetjanitor
profiles
scripts
sites
themes
yourpass

So let's do this from scratch

So let's do this from scratch ..
(let's take a backup of .htaccess files you you can revert back as needed)
1. Copy the Godaddy's .htaccess file on your computer and name it as "GODADDY.htaccess"
2. Copy your existing .htaccess file on your computer and name it as "MY_ORIGINAL.htaccess"

Now use your .htaccess file (you specified above)

See where it says
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

Remove the # sign before RewriteBase /, so it looks like this

# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /

See if it works now... ?

BASICALLY, this should be the structure:

>> Root website
http://engagebooks.ca

>>>> Sub-Folder "Matty_Cox" is this is the Root folder for Mattycox.com.
>>>> Then .htaccess file should have "RewriteBase /" defined at this level (at least with Godaddy hosting). This will ignore all 'path' rules defined inside the .htaccess of the root folder here.
>>>> Additionally ensure that Mattycox.com is pointing correctly to Matty_Cox folder in your hosting control panel.

Hi David, Just tried it, but

Hi David,

Just tried it, but it didn't work. I am still getting the following error message for mattycox.com :

Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.33 Server at mattycox.com Port 80

I am positive that Mattycox.com is pointing directly to Matty_Cox folder in my hosting control panel, so that can't be the error... I have searched the internet, and found that a few people have run into the same problem with shared hosting on Godaddy with a Drupal/htaccess file...

Should I try editing the .htaccess file that goes with my engagebooks.ca site? There must be a way to fix this error, but it seems to be impossible. I wish you were able to see my files in greater detail, as I hope I'm not omitting to tell you something vital...

I don't think so

Per my understanding engagebooks.ca is hosted in the root folder. Do not change that.
(Golden rule .. if it works . do not touch :) )

.htaccess inside "Matty_Cox" folder should override the engagebooks.ca .htaccess file.

TRY THIS 1:
Make a copy of your index.html and name the new file as "index.php" .. see if it works?

TRY THIS 2: (if the above approach does not work)
You can try another thing to isolate the problem .. just give 777 permissions to all files, folders and subfolders of Matty_Cox "temporarily" and see if the problem goes away ?

If it works .. then restore permissions one by one and see when it stops working again. Your permissions should not be above 644 or 755 for security purpose .. but 777 may help you to isolate the problem.

Leave "RewriteBase /" uncommented inside the "Matty_Cox" folder's .htaccess file.

I have 2 non-Drupal websites hosted on Godaddy (one on root and one inside a folder like you). I also had to deal with all those issues you are facing now. Godaddy's support is limited but I eventually figured it out myself. I know how frustrating it can be .. I think it will eventually work for you as well, just keep trying something or the other.

When I tried to change the

When I tried to change the index file to index.php I got this error code:

Parse error: syntax error, unexpected T_STRING in /home/content/a/r/o/aroumanis/html/mattycox/Matty_Cox/index.php on line 1

This is the script inside the index.html forlder:
<?xml version="1.0" encoding="UTF-8"?>

I checked the permissions for each folder of the website, but I could not find anything to do with changing permissions to 777? The permissions section only allowed for changing to read or write.

Glad to hear that you solved a similar problem with your site. There must be a way...

Right

You are right regarding permissions .. that was the wildest of my wild guesses.

If nothing works ..

If nothing works then you can try one last thing ..

I believe Godaddy offers free hosting with every domain name, just that with free hosting they have an ad-banner on the top. (doesn't matter for our testing purpose)

Remove mattycox.com from your main engagebooks.ca hosting account. Get a free hosting account for mattycoox.com .. put all your files, database in this new (free) hosting account. Now Matty cox will be on the root folder of this new-free hosting account. This new hosting account will have no interference what so ever from other domains.

If it works here, then you know something in Godaddy is messed up. If it does not then you have to figure out why?

The only bad part of this approach is that removing the domain name from it's current hosting account to this new "free" hosting will take time (probably 10 hours to a day). Your last resort may be to change your hosting to companies like hostgator etc .. which are usually more easy to deal with.

The easy way to see that

The easy way to see that mattycox.com works is to rename the .htaccess file that goes with engagebooks.ca, then mattycox.com works, but engagebooks.ca does not. I tried this out, but then quickly restored the .htaccess file for engagebooks.ca

So, I think it's definitely something messed up in the drupal .htaccess file affecting the non drupal site.

That's wierd

I believe that the "RewriteBase /" tag (in .htaccess of mattycox) is just for that .. it should prevent the effect of .htaccess file located in the root directory (of engagebooks). So, I am not sure that is going on.

Do you have another domain name (3rd one), that you are not using?
(say .. My3rdDomainName.com)

* Host My3rdDomainName.com as primary domain (in the root) - (No .htaccess file in root)

* Make subdirectory "engagebooks_directory" and point engagebooks.ca to it - (will contain .htaccess file of engagebooks)

* Make subdirectory "mattycox_directory" and point mattycox.com to it - (will contain .htaccess file of mattycox)

i.e.
(root) My3rdDomainName.com
(root\engagebooks_directory) engagebooks.ca
(root\mattycox_directory) mattycox.com

This way you are guaranteed that engagebooks and mattycox are totally separated out.

Technically you should not have to deal with this .. something wrong with Godaddy.

If you do not want all this mess .....
Try Hostgator! I have friends who really love them .. I haven't tried them personally.

.htaccess file basics

OK, so mattycox.com is some sort of "add on" domain under your primary domain (engagebooks.ca)? If it's set up in a typical manner, if you give the domain mattycox.com, it will read and process the .htaccess in the account root (engagebooks.ca's / directory), and then any .htaccess file in mattycox.com's / directory (/MattyCox/ ?). Did you leave your overall site .htaccess alone and put the Drupal .htaccess in /MattyCox/ (or whatever that domain's root directory is)? You should be able to do that, so that it doesn't affect any other domain on the account. It wasn't clear to me from your description where you had placed the Drupal .htaccess.

If the Drupal .htaccess is in the right place, but giving a 500 error, there must be some command in there that the server doesn't like. After I've posted this, and can see the whole thread again, I'll give it another going over (I recall that you posted it at some point). I seem to recall seeing Order allow, deny, but not the other code in that area:

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
  Order allow,deny
</FilesMatch>

Apache (the server) may not like having that Order all by itself...

Edit 1: You've got a mess of "php_value" lines. Most servers don't allow that, and give a 500 error. Put them in a proper php.ini file (the format of each line will change a little).

Edit 2: If you're on an Apache 2 server, it may not like the missing " at the end of the ErrorDocument line.

Edit 3: What happened to all the <some stuff> tags in the file? If you put the listing within <code> and </code> tags, it should ignore them. If not, replace all < with &lt; and all > with &gt;. You can't claim that this is a full and complete listing if you've edited out half of it!

Let's hope your approach

Let's hope your approach works for him.

IT'S WORKING NOW!

Thanks for the detailed description on a possible fix. I looked into what you wrote about, but it's a little complicated for me.

However I just found a workaround.

I went to the Site Redirect section of my Godaddy hosting account, redirected mattycox.com to mattycox.com/index.html and now it works like a charm. I did this for my other site planetjanitor.com and it worked too. The only thing I had to do was delete the .htaccess file that we added to the mattycox site, as it is no longer needed. So now the engagebooks.ca Drupal .htaccess file no longer affects my other websites. Whoot whoot!

I really hope this helps other people in the future. One thing to keep in mind, is that you first need to add your site to Domain Management as a Hosted Site with a subfolder on Godaddy, before you can add it to Site Redirects.

Thank you to everyone who helped me in this process. I wish that Godaddy could have suggested this workaround in the first place...

Cheers,

good to hear

good to hear that its fixed, at last!

but dude, redirecting isn't the correct solution.

I had the same problem with

I had the same problem with our Godaddy setup; Drupal in the root directory, and problems with another site in a sub-directory.

An .htaccess file with the following, placed in the non-Drupal sub-directory, solved my problems:

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks


# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found."
</Files>

# Set the default handler.
DirectoryIndex index.html



# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

</IfModule>

- L0rne

Thank you So much

I had the exact same problem redirect worked but adding another domain to a sub-dir did not. Godaddy told me that it was my .htaccess but they couldn't help. I just copied your .htaccess above and BOOOYAAAH! You just saved me hours. It's Beer:30 for you:)

Michael.

Perfect

Glad to know it works .. finally the poking around worked :)

Drupal7 on Godaddy

I manually installed Drupal 7 on Godaddy, planning on doing a 30 day learning and migration. My site http://intitechnologies.com went down within a day, as well as subaccount http://2cuonline.com No help from godaddy except to tell me to turn on script logging and review in 24 hours (after 3 days).
This has solved my issue at least both sites are up.
Also a note, an .htaccess file was in my root, images, css and template folders. How it got there I haven’t a clue…. just like Margaritaville…
Once I eliminated the .htaccess in root my site came back but without images or css, had to find and delete in all subfolders.
Thanks

Advertising helps build a successful ecosystem around Drupal.