Drupal Export of Site Not Working For Subdirectory Levels Beyond Root Directory - drupal

I have to move an existing Drupal site from one server to another. I've done so by doing a mysql database export/import and copying over the files to the new server. On the new system, the root page comes up fine but if I try to go to any deeper directory levels I get a 404 Not Found Error.
so drupal.newserver.com -> works fine
but drupal.newserver.com/user -> gives me a 404 and happens,same for all subdirectories
Is there something that I'm missing that is part of a drupal export? Could it be related to the structure of the /sites directory which is under the webserver's docroot?- which has a folder named after the old server (ie drupal.oldserver.com but not drupal.newserver.com? Also, I noticed that there are _htaccess files and .hta files but not .htaccess files in the site files that I've copied over.
Sorry if I'm asking a bleedingly obvious question - I'm very new to Drupal. Thank you!

Check whether the clean url is enabled in your web server. To check try this:
drupal.newserver.com/?q=user.

Just to let anyone who might come across via a google search - I was able to get this to work . It turns out that while mod_rewrite was enabled, what I had to do was to enable the AllowOverride directive for the web directory in httpd.conf to be set to ‘All’. If it’s not set to this, the server won’t respect the .htaccess rules you put into the drupal directory. It’s been a while since I’ve worked with apache config files so it took a while to finally piece it together. The main breakthrough came when I realized that if I turned off clean-urls then the links worked but looked ugly and then was able to research clean_url.

Related

MAMP Start Page Only Shows Index

I'm trying to install Wordpress on MAMP using this tutorial. When I start the MAMP server and go to the MAMP startup page, I see this index instead of a GUI. As a result, I can't access the PHPMyAdmin GUI (despite the PHPMyAdmin link) to create a database for Wordpress. Does anyone know what I might be doing wrong? I'm running OSX 10.9.5.
Try that url to access phpmyadmin
http://localhost:8888/phpmyadmin/
This is the directory listing that Apache provides in some cases. When a folder is requested, Apache looks in a folder for a file name matching the DirectoryIndex directive, which are often files such as index.php, index.html, home.htm, and so on. Since none of those exist here, the directory listing is shown.
Basically, something isn't right here with your MAMP install; either this URL is not designed to be accessed by you ever or your installation is incomplete. First, try loading http://localhost:8888 directly and see if that works any better for you. Failing that, I suggest you make a backup of any MAMP related files (databases, web pages, or configuration changes) and reinstall. One possible cause of this is if the MAMP package is not installed to /Applications/
In short, when you're using an all-in-one package like MAMP this shouldn't happen. You say that when you uninstalled and reinstalled that fixed the problem which is what I would have suggested anyway. It seems something went wrong with the installation and that should (and did) fix it.
I add the solution that helped me in the similar situation just in case someone later will face the same problem when after the Wordpress has been installed, a browser just show "Index of/" instead of the required site.
Check the following points:
There is 'index.php' file in the root folder of your project. (web server tries to open exactly this file).
If the file actually is located there, check the configuration of your web server. For example in my case my web server is Apache 2.4. After I added the directive "DirectoryIndex index.php" in the Apache configurations file (thereby saying to the server which file it should open if it received the address of the root folder) my problem was solved.

Index.php in uploads directory - Wordpress

I have a plugin on a Wordpress site called WP Security, most of the stuff it does is easy to use and understandable, the changes it suggests like not have default 'WP_' prefix for databases etc.
One of the things it highlights is: The index.php file was not found in the uploads directory! You should create one in order to prevent directory listings.
So can anyone tell why preventing directory listings is good and do I need to put anything in the index file, and if so what code do I need to put in? Finally what is the importance of the index file in website I don't really get this part of web design? I have read it has to be there to make site visible to browsers but why is this, why can't browsers just use the URL with no index page?
Thanks for suggestions
Andrew
Yes, blocking directory index is a good idea in web apps. The index.* file is interpreted by web server instead of providing standard directory listing. Creating an empty index.* file is ony one (although the easiest and compatible with all(?) http servers) way of blocking users from viewing the contents of the directory. Another way is to configure webserver to not serve the directory index. In Apache this can be done in the .conf file with
Options -Indexes
in the <Directory> clause. Or you might tell apache to:
AllowOverride All
And create a .htaccess in the directory containing:
Options -Indexes
line.
Yes creating index.* file is really necessary to protect your asset as absence of index files shows whole directory structure and listed assets.
Easiest way to create an index.php file with simple coding.

Does WordPress do something that overrides .htaccess?

I'm working locally on a WordPress site for a client. The client keeps their install of wordpress in the server root, but because I have more than one client, I like to install everything in a client folder, like localhost/client. Normally it's a simple matter to add a rewrite rule to .htaccess, setting the rewrite base to be /client/. But today it's not working at all. Even if I put nonsense in the rewrite rule, the site works (which it should not, if the rewrite rules are in effect). The images references are still looking for root at localhost/, instead of localhost/client/, which means they are broken.
I looked into WordPress's documentation and found it has something called WP_rewrite, and there is a place to set parameters for it in wp-includes/rewrite.php). I set the root parameter to client/ but that doesn't seem to have any effect either.
One last thing: there is an .htaccess file in localhost/client/, and another one in localhost/client/wp/. I have them both set to RewriteBase = /client/, but I've tried just about every other sensible combination--no change.
So my question is: does WordPress do something else that would make the rewrite rules I set in .htaccess not work?
I'd recommend a small change to your local environment for a more flexible solution. Use virtual hosts. If you're running WAMP/MAMP, this tool is readily available to you. It allows you run a directory within your localhost as its own site, which you can access using a local-only URL of your choosing. I have my sites set up as sitename.local, for instance, so they all live in their own happy little ecosystem. Highly recommended.
Yes it does, you have to make some steps that will change entries in db before you move it to subfolder.
Here are detailed info:
http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Within_Your_Site
What you need to do:
copy everything as it is setup on your clients server i.e. in root folder
do the steps in above url, important are 4. & 5.; step 10. actually just go to permalink settings and click on "Save" button (or "Update" I do not remember how it says)
Now you can work :)
Are you modifying only theme or what?

What should I check for when I cannot upload files into filefield CCK fields?

I have recently moved a drupal site. (both servers run on a debian based LAMP stack) Everything works great here, including the uploading of images via a CCK filefield. Original url:
dev.example.com/foo
Deploying it to a test folder on the production server to a test folder for an environmental shakedown cruise lead it here:
www.example.com/foo
Everything works here too, including image uploads. After adjusting sites/default/settings.php, then making it readonly again, I renamed the folder to its production name:
www.example.com/bar
Everything works fine here except for image uploading. I've adjusted the webroot variable within settings.php .
Things I have tried so far:
Gave php system user write permissions to sites/default/files (images are set to go in sites/default/files/images but imagecache just puts them in sites/default/files)
Enabled file php file uploading for www.example.com/bar/sites/default/files
Are there any other configuration settings I should be looking out for here? I'm running low on relevant solutions.
Edit: I had quite the typo there, I adjusted sites/default/settings.php, not sites/default.settings.php .
Your question is slightly confusingly framed. default.settings.php has no impact on Drupal -- its merely a template. The file that contains the actual database connection information and other configuration is settings.php.
You may also want to look at your .htaccess file in your root Drupal folder and try changing the RewriteBase directive to the folder you are accessing your site on. Usually you should not have to change the $base_url directive in the settings.php file that you may/may not have done. Reverse that change for now if you have (you may need to play around with that later though).
imagecache will always upload the image derivatives in sites/default/files but imagefield will upload the original image in the folder you specify (within sites/default/files). You will get a setting for the imagefield under Manage Fields->[Name of Image field]->Configure under Path Settings.
Please google to understand the difference between imagecache and imagefield. Make sure your sites/default/files (and subfolders) are writable by the apache user (usually www-data).
In such situations, its usually a good idea to pick up a book on apache (if you haven't already) and try to understand how it works. It will be time consuming but will help you out in the future when you encounter configuration issues like this.
This worked for me. When having issues uploading images to a cck field, I gave write permissions to directory:
sites/default/files/field/image

Drupal to Drupal Migration

I am attempting to migrate hosts and am having issues migrating from one Drupal instance to another. I have a multi-site install. I am attempting to maintain the files/code as well as databases. I have transferred the files from the instance of Drupal from my old server to the new server. I have exported the databases via phpmyadmin and imported them back in with cli. For some reason the homepages for my sites work but the internal pages do not. When i try to navigate to a page I get The requested URL was not found. I have installed and ran a new instance of drupal 6 (same version) on the new server and it seems to work fine. I assume it is something I am doing wrong with the porting process? Any help greatly appreciated!
Did you transfer the .htaccess file(s) too ?
Those are "hidden" (their name is starting with a '.'), and not shown by default by some FTP transfer software...
(I've seen exactly this problem a couple of days ago, and getting the .htaccess from the old server and putting it on the new one saved the day ^^ so maybe you're having this problem too...)
You could have avoided that by only migrating the sites/ directory. Extract the latest version on your new server and copy the modules, themes, and settings from your old site. Of course the database will need to move also.
This assumes your site is up to date and you haven't modified the drupal core. You may have a custom install profile to copy over too.
There are some important things to keep in mind before migrating from one Drupal instance to another
1. Optimize the tables before exporting the database.
a) By clearing all the temporary tables
b) By removing website cache.
For more details go through the following link:
http://goldapplesoftware.ca/blog/2011-05-reducing-drupals-disk-temporary-table-usage
2. Export database with command line so no data is lost.
Check your httpd/apache conf file... be sure to add:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Resources