I made a working site running on my PC with Uniserver and Drupal 5.2, upgraded to 5.6.
I copied the drupal files to the live site by FTP (I tried to install with Fantastico but it appeared not to work).

Then I managed to import my database, and can see the front page of my site (hooray!).

But none of the links work. I get a message like:

The requested URL /~[username]/drupal/node/5 was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Drupal is installed in /public_html/drupal

http://[ip-address]/~[username]/drupal shows me my front page.

I think there's a (separate?) problem here, in that I think I'll need the front page to appear just with http://[ip-address] without the /drupal. (I haven't changed the DNS yet). I think my index.php is in a subfolder of where it should be.. but that's the location I have it on my test site on my PC where it works ok otherwise.

From reading the forum, I thought I could fix the error messages by fiddling either with .htaccess or settings.php, but I have had no luck yet. I've seen several people with the same problem, but no clear solution.

If I uncomment "RewriteEngine on" in .htaccess the error message changes to:
The requested URL /home/[username]/public_html/drupal/index.php was not found on this server.

The drupal .htaccess is in public_html/drupal, and there's a tiny ,different one, made by the hosting server in public_html.

Any ideas? I'm not sure what information I should provide.

Thanks very much if you can point me in the right direction!

Comments

tdimg’s picture

Have you tried to set the $base_url in your settings.php (can be found in sites/default) to:

http://[ip-address]/~[username]/drupal

- you would need to change this as soon as you changed your DNS.

ctsrutland’s picture

Thanks.. I tried that and got:

The requested URL /~[username]/drupal/node/2 was not found on this server

tdimg’s picture

did you also try it with public_html in there between the username and drupal?

ctsrutland’s picture

Thanks again for your help.

I've uploaded again from scratch, because it was getting messed up by my fiddling.
Now drupal is in the root of public_html instead of a subfolder.

I still have the same problem.

I've tried all variations I can think of for $base_url:
ip-address\username
ip-address\~username
ip-address\username\public_html
ip-address\~username\public_html

If I go to http://[ip address] then I see the text of my home page but with no css applied to it
If I go to http://[ip-address]/index.php then I see the proper front page, but as I say none of the links work:

The requested URL /home/rutlandb/public_html/index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Here's my .htaccess (commented out bits removed):

# 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

# Customized error messages.
ErrorDocument 404 /index.php

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

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 cache dynamically generated pages.
ExpiresByType text/html A1

# Various rewrite rules.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.81.2.3 2007/09/21 12:24:22 drumm Exp $

tdimg’s picture

Could you tell me the IP address (c2uk [at] gmx [dot] de - or contact me through drupal), so that I could have a quick look myself, I'd especially like to investigate these to occurrences:

If I go to http://[ip address] then I see the text of my home page but with no css applied to it
If I go to http://[ip-address]/index.php then I see the proper front page, but as I say none of the links work:

I'm off now for some time, might be back later and have a look then.

ctsrutland’s picture

OK.. it's no secret really:
http://vc10.eukhost.com/~rutlandb/ (the ip seems to have resolved itself)

Could the missing css might be a cache problem? When I view the source of the incorrect page it points to css files in public_html\drupal .. but since I deleted and reinstalled directly in public_html that's the wrong path. When I add index.php to the URL it points to the correct css path. I tried a different browser so it isn't a local cache on my pc.

Or is there another file I should have replaced when I reinstalled but didn't.. hmmm. I could reinstall from scratch a third time.

Thank you.. you're a star.. I'd reached the conclusion that I need to go and RTFM to find out exactly how drupal works so I can figure this out myself.. though half the point of drupal was to be able to make a site without getting too techy! oh well.

ctsrutland’s picture

I have fixed the dead links by editing .htaccess to say:

RewriteBase /~rutlandb/

which I found by googling.

I still have the css-less front page when I omit index.php from the URL in my browser.

There's a picture missing off the front page .. haven't looked into it yet.

And the calendar says there are no events when I know there are some. One step closer...!

tdimg’s picture

I see you're solving all your problems on your own, well done indeed!

tdimg’s picture

Normally, you should be able to get drupal up and running and even a decent website without going into too much techy stuff, but your case seems a little bit strange.

1. index.php with css vs. / and no css:
For some absolutely odd reasons, your base url in index.php is correct: /~rutlandb/ but in the one where it doesn't work it is "/rutlandb/drupal/" - I've got absolutely no idea where this might be coming from or how this might be even possible, your htaccess seems to be fine. This might have to do with drupal caching, have you by any chance enabled this in admin/settings/performance?
1.a) on the band gallery, the links use the IP address.

2. page not found:
When not using clean urls, i.e. using index.php?q=node/2 for example, you get the right destination, that might indicate that your host doesn't support mod rewrite, try deactivating it by going to index.php?q=admin/settings/clean-urls - hope you are logged in, if not you need to uncheck clean urls before you export your database from your local setting.

- forget it, this seems to work now, well done!

Edit: I just see, yes the rewrite base url, forgot this one, shame on me! I remember now, I had the same exact problem a couple of months ago with a new website of mine...

ctsrutland’s picture

You're right.. turned off caching there and it's sorted.. thanks for the help!

chrispooh’s picture

Hi, just enable apache2 rewrite module and everything will be ok.

lanouettea’s picture

I had a similar problem and have been struggling with it for the last few hours.

When I built my Drupal installation a year ago, I developped everything on my local PC, then moved the site in production, accessible to anyone. I added little by little more stuff to it (I customized the template, added more content type, etc). But everything I did was no accessible to users that were not admins, so (I know it's not the best practice, but!) I made my changes directly in production.

But for the latest updates I needed to do, I had to make the changes on a development installation before putting everything in prod. I exported my drupal installation folder, exported and imported my database, modified my settings.php and .htaccess files, ran update.php. I then accessed my front page with my template and everything. Then I tried to see another page: URL not found. I then guessed that the problem was coming from the paths (I recalled using the ?q= when developping at first.). I thought this module was the path module and path auto (which was not..... darn!).

Seeing your post made me remember that it was clean urls. Thanks for the link. Deactivated it, then it all works flawlessly.

truyenle’s picture

I have been looking for this for days and finally it is here.

Thank a lot.

For my case, I just go back to development site and go to admin/settings/clean-urls and disable the clean URLs. Then re-export database and then import it to the production site.

It is ok now.

Thank a lot tdimg.

Truyenle

madjr’s picture

just wanted to add that if site is in offline (maintenance) mode it may also prevent things from working

in my d6 install on my web server, i tried exporting things back to my localhost, but it was not working, so i fix it by:

-turning clean-urls off
-putting the site back in online mode
-re-exported the db with the new above configs and imported to my localhost.
-commenting and disabling the line in settings.php the domain/base url is specified.
i.e.
# $base_url = 'http://example.com'; // NO trailing slash!

-may also need to remove/rename the .htaccess file in your localhost.

note: this post was high ranked on google (so it's easy to find) and had some useful info, but still my case was a bit different.
So this should help anyone with similar issues or Just in case i forget and mess up again :)

Dharmendra.s’s picture

I have the same problem can you tell me exactly , what we will do , so wy site link works properly
Please...Help Me...

hellagood’s picture

I guess i should post this in a new issue instead of here - sorry