Skip to content

Instantly share code, notes, and snippets.

@rickharris
Created August 8, 2011 02:49
Show Gist options
  • Save rickharris/1131120 to your computer and use it in GitHub Desktop.
Save rickharris/1131120 to your computer and use it in GitHub Desktop.
Patch for customizations of .htaccess and robots.txt for Drupal 7
diff --git a/.htaccess b/.htaccess
index 9494b53..bb88992 100644
--- a/.htaccess
+++ b/.htaccess
@@ -84,8 +84,9 @@ DirectoryIndex index.php index.html index.htm
# 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]
+ # (see http://stackoverflow.com/questions/2621089/non-www-htaccess-redirect-ignore-other-subdomains)
+ RewriteCond %{HTTP_HOST}//s%{HTTPS} ^www.(.)//((s)on|s.)$ [NC]
+ RewriteRule ^ http%3://%1%{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/...)
diff --git a/robots.txt b/robots.txt
index 35ea42d..72a16eb 100644
--- a/robots.txt
+++ b/robots.txt
@@ -57,3 +57,9 @@ Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/
+#Custom Rules
+Disallow: /node/
+Disallow: /index.php
+Disallow: /taxonomy/
+Disallow: /contact?
+Disallow: /?q=node
diff --git a/sites/sites.php b/sites/sites.php
new file mode 100644
index 0000000..829956c
--- /dev/null
+++ b/sites/sites.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @file
+ * Configuration file for Drupal's multi-site directory aliasing feature.
+ *
+ * Drupal searches for an appropriate configuration directory based on the
+ * website's hostname and pathname. A detailed description of the rules for
+ * discovering the configuration directory can be found in the comment
+ * documentation in 'sites/default/default.settings.php'.
+ *
+ * This file allows you to define a set of aliases that map hostnames and
+ * pathnames to configuration directories. These aliases are loaded prior to
+ * scanning for directories, and they are exempt from the normal discovery
+ * rules. The aliases are defined in an associative array named $sites, which
+ * should look similar to the following:
+ *
+ * $sites = array(
+ * 'devexample.com' => 'example.com',
+ * 'localhost.example' => 'example.com',
+ * );
+ *
+ * The above array will cause Drupal to look for a directory named
+ * "example.com" in the sites directory whenever a request comes from
+ * "example.com", "devexample.com", or "localhost/example". That is useful
+ * on development servers, where the domain name may not be the same as the
+ * domain of the live server. Since Drupal stores file paths into the database
+ * (files, system table, etc.) this will ensure the paths are correct while
+ * accessed on development servers.
+ *
+ * To use this file, copy and rename it such that its path plus filename is
+ * 'sites/sites.php'. If you don't need to use multi-site directory aliasing,
+ * then you can safely ignore this file, and Drupal will ignore it too.
+ */
+
+/**
+ * Multi-site directory aliasing:
+ *
+ * Edit the lines below to define directory aliases. Remove the leading hash
+ * signs to enable.
+ */
+$sites = array(
+ 'localhost' => 'oc-dev', // just in case...
+ 'orangecoat.net' => 'oc-dev',
+ 'prep.orangecoat.com' => 'oc-dev',
+);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment