Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: How To Redirect When Site Moved From Subfolder To Server Root

Submitted by on May 9, 2012 – 10:41 pmNo Comment

When a site is under construction, it is often allocated in a subfolder of a working site. Search engines index it. And when the site is moved to root of a server, all indexed links break. This is not good. In addition, somebody could refer to the site while it’s being in a subfolder…

Solution:

Add the following code:

RewriteCond %{REQUEST_URI} ^/subfolder
RewriteRule ^subfolder(.*)$ http://site.ru$1 [R=301,L]

After these lines in  .htaccess file (which is located in a site root):

<IfModule mod_rewrite.c>
RewriteEngine on

How it works:

  • http://site.ru/folder → http://site.ru
  • http://site.ru/folder/ → http://site.ru/
  • http://site.ru/folder/* → http://site.ru/*

Advantages:

  • Keeping of links value (with such redirect, search engines pass value to a new page)
  • Old links still work

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.