I am trying to migrate my Drupal website from localhost to server, but I am having some problems. I tried many guides from Google, but with no luck.

What I did:

First I did a fresh drupal installation on server

Once installation was complete I edited the .htaccess file as

RewriteBase /site-name

Then I used mysqldump to dump my database from localhost to server I found that I had total 126 tables in localhost while in server I had 128 tables

Then I copied my complete "sites" directory from localhost to server

My problem:

Now when I enter www.mysite.com/site-name I get proper home page of my website but if I go to any other link such as www.mysite.com/site-name/user it is not able to open the page but if I enter www.mysite.com/?q=user then it works perfectly and this happens for all pages such as /content, /config etc.

What should I do to solve this issue? I think it is a problem of clean-urls So I went to configuration but it said clean URL enabled but test failed!

I need to make website live by tomorrow so need your help!

Note: I am using ubuntu on localhost as well as server


  • to enable mod_rewrite use this command: sudo a2enmod rewrite then restart apache with that command: sudo service apache2 restart.
    – Elin Y.
    Jul 27, 2014 at 7:17

3 Answers 3

  • To avoid requiring ?q=user or ?q=some/page/path you should assure ModRewrite is enabled on your Apache webserver. If you're on shared hosting you made need to ask your host provider to enable this module of Apache.

  • Moving a Drupal site is essentially moving all the PHP + MySQL data from 1 computer to another. Pick you're tools: mysqldump + zip, rsync, scp, ftp ... Drush whatever ... but the procedure is essentially the same -- move everything in it's entirety.

Why you have 2 less tables between your Drupal installs is unfortunately simply bad project management on your behalf -- good luck tracking down the differences.

Comparing drush pm-list between the 2 Drupal installs should help to find any modules on 1 system and not on the other. I like using drush archive-dump and drush archive-restore to move Drupal sites around -- but under your time constraint I recommend using SQL migration tools and code migration tools your comfortable and most familiar with.

  • can you please explain more about ModRewrite how to enable it? Jul 27, 2014 at 6:25
  • 1
    This is a drupal question forum. Please consult the drupal handbook on drupal.org, or Google regarding modrewrite and how to enable it for your linux distribution.
    – tenken
    Jul 27, 2014 at 6:31

This is because you need to configure the virtual host in your server. Also with proper permissions. clean-urls are associated with mod_rewrite.so file. So in your apache configuration you need to enable mod_rewrite.so and restart httpd or apache2 process.

Depending on the distribution you are using (you should have mentioned that in your question) I'm giving you 2 links to look to.

How To Set Up Apache Virtual Hosts on CentOS
How To Set Up Apache Virtual Hosts on Ubuntu

EDIT # 1 As this is a Drupal only discussion forum, please consult http://askubuntu.com for the server related issues. But for your help I'm giving you a link in how to enable mod_rewrite.so. Every deployment process should be consistent with the development server to the production server. So as of me, you should make a complete zip/tar of your local installation and upload it to Production. The archive should consist of your local Drupal installation database as well. This table difference may have caused due the recent updates of Drupal core or due to some contrib module installation. The links I provided is to tell you how to setup virtual host in servers that are fully managed by the user. If you face any issues, then its better to consult with the server support team and I hope they will help you because you are paying them ;).

  • Distribution added to question ..Thanks for the links..also should I add drupal.conf in /etc/apache2/sites-enabled ? Jul 27, 2014 at 6:14
  • See my edit #1. Jul 27, 2014 at 6:46

In the command line:

sudo nano /etc/apache2/sites-available/[your-vitualhost].conf

then put, AllowOverride All into your <Directory>, like this:

<Directory /var/www/>
        # ...                 
        AllowOverride All # this allow use the .htaccess file.
        # ...

Lastly, ensure mod_rewrite is enabled:

sudo a2enmod rewrite

Then, restart apache:

sudo /etc/init.d/apache2 restart


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.