Main page (homepage) works fine, all others give 404 error

drn1111's picture

Ok, so I decided to move hosting providers. I transferred all of the content, I transferred all of the databases, I edited all the configs for the databases so that they would see and login to the new MySQL location. When I go to the website the main page pulls up fine, however, if I try going to ANY other pages (unless it is a direct link to an add-on website), or even logging in for that matter I get a 404 Page not found page...and it's not the custom when I have setup in Drupal.

Take a look around the new host, you get 404 errors on almost everything you click on unless it is a named link back to the old host.
Please help me people, I have absolutely no idea how to fix this issue. If you have any questions please reply here and I will answer them as quickly as possible.
Thanks a million in advance!

Comments

Clean URLs

JCL324's picture

Sounds like the new server is not setup to do clean URLs. You'll have to check with the hosting co. to figure out how that's done.

JCL

check .htaccess file

greta_drupal's picture

Check your .htaccess file. Upload, or copy/paste, this one:

Check .htaccess file

greta_drupal's picture

Edit the .htaccess file in your Drupal root folder. Maybe issue with the symlinks. Try to copy/paste the below, and see if that resolves (it has worked for me in the past for same issue):

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch ".(engine|inc|info|install|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>

# 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.
<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.php

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

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  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
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  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
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  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
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

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

  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  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]
</IfModule>

# $Id: .htaccess,v 1.90.2.3 2008/12/10 20:04:08 goba Exp $

good tank`s

saeid.ahmady's picture

good
tank`s

You may not even have copied

bhosmer's picture

You may not even have copied your .htaccess from your other site. I had this same issue and pulled my hair out until I figured out this was the culprit. Usually on your local machine, it is a hidden file and you don't even know it is there.

That did it for me as well..

RoTalk's picture

I was surprised that I migrated a site and forgot to include the .htaccess which freaked me a out at first trying to figure it out. Just copied the file from another directory/site hosted on the same server.

Sounds like classic missing

StuddMan's picture

Sounds like classic missing .htaccess file

"Almost everything"

verta's picture

I agree somewhat more with the first post since this did happen to me a couple of times.

Have you tried links with and without the "?q=" yet? If you have links that assume clean urls is working, but it's really not, you'll have trouble with them. Try yoursite.com?q=admin/settings/clean-urls and turn them off. You may have to recode your hyperlinks that used the clean urls, they won't work when it's turned off.

That way you can debug why clean urls aren't working but your site will still work while you work on it.

Thanks to everyone

drn1111's picture

Thanks to everyone to help me with this issue. The .htaccess file is missing and now is working only some time and some time take long time to load any page 20-30 min and browser tell me too long to upload. I don't know what is wrong with this site. Work for two month and stop working. I can't login now. Please any help will be very greatly appreciated.

http://www.orlandoairporttaxi.info/orlando2/

Thanks a million in advance!

can you get into the site logs

verta's picture

My guess is that something is up with your web server. See if you can read your web server logs, your back end administration login should have a place where you can get to your site's logs.

The .htaccess file might look like it's missing because it is hidden. The dot means it is "hidden" so be sure you have set whatever you are using to look at the files to show hidden files.

Try using FTP or the administration pages file transfer to put the file on your site.

My other thought is that it looks like you have put your new Drupal site into a sub folder of your existing site, perhaps others looking at this will spot something about that, especially .htaccess related.

You might want to register a different domain name for testing the new site, make a new folder on your hosting account for it, and put your site in the root of that folder.

also check your PHP error logs

verta's picture

I can't get to the login screen on your site using ?q=user either, so there's something going on that you're probably not going to figure out without reading the apache and php error logs. You should contact your hosting provider if you don't know where the logs are.

It could be something as simple as permissions on the folder, make sure the web server has sufficient permission. You'll see permission errors in the logs if that's what is going on.

PPHP error lods

drn1111's picture

php error logs is not working and go daddy techincal suport tell me is not go daddy problem host account is working.

THANK YOU!!!

drn1111's picture

change the host to Bluehost and the site working no problem go daddy is the worst host ever and NO customer support

http://www.orangetrans.com/

Thank you!!

mandermonkey's picture

I wish I would have began looking for this post a few hours ago! But thank you for your help, you saved me many hours of work!

.htaccess and settings.php

chen.730's picture

For me, I got help from my host company support. (The clean URL doesn't seem to be the cause of the problem.) They suggested that the issue is only present when you try to access your site with the temporary url and would NOT be present when the domain is pointing at the right DNS. So you could:

  1. Change a system file (a file called "hosts") on your computer to make your browser thinks the temp url is the right one: http://www.inmotionhosting.com/support/website/drupal/how-to-create-a-me...

  2. Or change settings on your site. Two files:
    a) .../sites/default/settings.php
    Set the $base_url and un-comment it.
    $base_url = 'http://yourtempurl.com/directory';
    and
    b) .htaccess:
    Set the RewriteBase and un-comment it.
    RewriteBase /directorytoyoursite

The 2nd method worked for me.

RewriteBase solved it for me

millionleaves's picture

I just moved a site to a Bluehost VPS. The front page would load fine, the internal pages generated an error.

I changed RewriteBase to:

RewriteBase /

and it worked.

@chen.730 - thanks for your suggestion.

IT WORKED!

manuel.solis's picture

Thank you!! Thank you very much!

b) .htaccess: Set the

matiaslezin's picture

b) .htaccess:
Set the RewriteBase and un-comment it.
RewriteBase /directorytoyoursite

It did the trick for me, thanks!

.htaccess file issues

redearthbluesky's picture

Hello, same problem. Xampp error logs showed I was in a loop when clicking links, the homepage loaded fine but no access to admin either. A co-worker came up with the following solution in .htaccess;

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

.htaccess file issues

ferenju's picture

Hi,
One solution that can help you is disabling clean url check box in your old drupal admin/config section, before you move any files to the new server location

Here are the steps
OLD SERVER
1. disable clean url (in drupal admin)
2. Set your theme to one of drupal's core theme,
3. clear catch
4. FTP, or zip your drupal files and DB from old server and transfer them to the new server.

NEW SERVER
5. Create DB on the new server with user privileges and import the old DB
6. import all old files and extract.
7. change permission for folder site/default from 0555 to 0755
8. update the DB connection on site/default/setting.php
9. change permission for site/default BACK to 0555.

That is all !!!
check your site hope it will work.

AD

.htaccess file issue

Nitishkumar's picture

This was missing .htaccess file. It worked for me after adding .htaccess file

Thank for your comment

lxbon's picture

I'm facing this problem for my website dich vu viet luan van. I'm trying to solve this

Florida

Group organizers

Group categories

Florida Topics

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week