Moving Drupal from Linux to Windows IIS

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 7
Joined: 01 Apr 2012, 20:08

Moving Drupal from Linux to Windows IIS

01 Apr 2012, 20:32

First I have to say I don't have a lot of a Linux / PHP skills. Just enough to get things done with some help. I manage a lot of .NET-based websites on Windows servers. I am fairly resourceful but sometimes don't have a good understanding of the fundamentals to solve a problem. I think that is the case with my current issue.

I have a client that had another consultant create a Drupal site that he had on a shared Linux / Apache hosting account. I manage a large .NET web application for this company on a dedicated Windows server. The server is setup as a hosting server with all the right tools on it for both .NET and PHP as well as MSSQL and MySQL. They were having some issues with the other consultant and so they wanted me to migrate it over to the Windows server. Because of relational issues I don't have access to the other consultant. Here is what I did.

1. Migrated the code files into the hosting folder for this site.
2. Created a new db and used HeidiSQL to load in the existing db.
3. Resolved an issue with not having PDO for MySQL enabled.
4. Resolved an issue with too small memory_limit setting.

The site home page comes up now without issue. But when I tried to access an internal page I got a 404 error. So I got some advice to install Helicon Ape and ISAPIRewrite3. That has been done. Now I don't get a 404 error, but when I click a link to an internal page it doesn't redirect to the other page.

http://www.blueribbonschools.com/ is the home page.
http://www.blueribbonschools.com/assessments is the format of an internal page.

So I wanted to look into the .htaccess file and see if there were some rules I could understand and possibly change. I see an htaccess in the site root with quite a bit of stuff in it and another in the sites/all/default/files folder with just these three settings.

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

Now back to the root htaccess file.

First I noticed that there were some commented out rules that would redirect non www requests to use the www and that is something I wanted to have. So I tried to uncomment that in the Helicon Config Editor. But I immediately got a bunch of errors for almost every line and so I couldn't save these changes.

That got me to thinking that maybe the htaccess files that went with the Linux installation might need to be replaced with some Windows version or something like that.

If not then what could be the root of my problems here? Thanks for any help you can provide.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Moving Drupal from Linux to Windows IIS

02 Apr 2012, 05:01

Hello,

It would be great if you could show the root .htaccess file and I'll try to fix it for you.

User avatar
Posts: 7
Joined: 01 Apr 2012, 20:08

Re: Moving Drupal from Linux to Windows IIS

02 Apr 2012, 09:56

This is the current file. I turned off clean urls in the settings but would rather have it working since the person who created the site created a lot of direct links on the home page using clean urls. I put the three lines that are in the site specific htaccess file in my original post if that matters.

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
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

# Multiviews creates problems with aliased URLs and is not needed for Drupal.
Options -Multiviews

# 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 index.html index.htm

# Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.php and drupal_initialize_variables() in
# includes/bootstrap.inc for settings that can be changed at runtime.

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag magic_quotes_sybase off
php_flag register_globals off
php_flag session.auto_start off
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_flag mbstring.encoding_translation off
</IfModule>

# PHP 5.2.4
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

# 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

<FilesMatch \.php$>
# 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
</FilesMatch>
</IfModule>

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

# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]

# 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/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [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 the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [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 /

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>

# $Id: .htaccess,v 1.111 2010/11/23 02:59:05 dries Exp $

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Moving Drupal from Linux to Windows IIS

03 Apr 2012, 07:47

Let's try to fix the mod_rewrite part as follows:

RewriteEngine on

# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]

# 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/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .? http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NS]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [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 /

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/favicon.ico [NC]
RewriteRule .? index.php [L]

# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>


Please test and report the results.

User avatar
Posts: 7
Joined: 01 Apr 2012, 20:08

Re: Moving Drupal from Linux to Windows IIS

03 Apr 2012, 11:40

Anton, thanks so very much.

I basically deleted all the code in the existing htaccess because apparently it was mostly directives that don't work with IIS. So I copied in your code and saved the file.

The site is functioning better. I can move around on a few pages. Here are my issues. The previous developer has done some stuff to make this more difficult.

If I just type blueribbonschools.com into a browser I sometimes first get redirected to a page that has It Works on it. Then if I refresh the page the site comes up. I don't see any other web pages that have It Works in the code anywhere. So could this be dynamically generated somehow?

The main menu at the top of the page has 5 links. 3 have clean urls like http://www.blueribbonschools.com/conferences and two have full urls like http://www.blueribbonschools.com/?q=about. The full urls work fine but the clean urls don't work and just redirect to the home page.

If I turn on clean urls in either the db directly or settings.php using
$conf['clean_url'] = 1; I see that every link I click tries to use a clean url but as I said they don't work.

Also there are a bunch of sitewide links on every page at the bottom left that all reference clean urls. So none of them work either.

Unfortunately, the admin login I was provided doesn't even work.

Any other ideas you have to get the clean urls working and the mysterious "It Works" page that sometimes pops up would be so much appreciated.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Moving Drupal from Linux to Windows IIS

04 Apr 2012, 04:59

Hello,

Let's try to fix your config like this to make it work with clean URLs:

RewriteEngine on

# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]

# 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/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .? http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NS]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [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 /

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/favicon.ico [NC]
RewriteRule ^(.+)$ /\?q=$1 [L]

# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>

Please try it again. The clean URL must work.

As for the It Works page, you can try to track where it comes from in some debug tool.

User avatar
Posts: 7
Joined: 01 Apr 2012, 20:08

Re: Moving Drupal from Linux to Windows IIS

04 Apr 2012, 11:14

As far as I can tell it is all working now. Anton, I cannot say thank you enough for your help. Now that the crisis is over and the site is up for people to register for the conference I will study the code you sent and learn more about htaccess directives for IIS.

Have a great day!

User avatar
Posts: 1
Joined: 19 Aug 2012, 16:51
Location: Соломоновы острова

Регистрация сайта на трастовых площадках

19 Aug 2012, 16:51

Предлагаю прогон по 150 трастовым сайтам с тиц 10 и выше.
Все ссылки индексируются поисковиками,нету запретов на индексацию.
Отчёт о прогоне (Список всех сайтов с ссылками на вас)
Стоимость 3 у.е
ICQ 611331083

User avatar
Posts: 1
Joined: 25 Oct 2013, 00:40
Location: Индия

Дешёвый прогон по 140+ трастовым профилям

25 Oct 2013, 00:41

Предлагаю качественный прогон по 140+ трастовым профилям.
Показатели профилей:
Минимальный тиц-10.
Максимальный тиц-600.
Все ссылки открыты к индексации,без noindex,запрета в robots и nofollow.
В отчёте прогона вы получите Все ресурсы с ссылкой на ваш сайт.
По желанию клиента ссылки добавлю в аддурилку яндекса (бесплатно).
Стоимость услуги 5$ или 150р.
Имею персональный аттестат webmoney bl 150+.
Icq 696384444

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 8 guests