Solved

301 redirect htaccess subdomain pages to main page

Posted on 2010-11-08
2
422 Views
Last Modified: 2012-05-10
Hi,

I'd like to 301 redirect several subdomain pages to the main page (http://omusicstudios.com)

Here is the part of my htaccess:

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^teachers/don.html$ /teachers/don.php
RewriteRule ^teachers/doug.html$ /teachers/doug.php
RewriteRule ^teachers/megan.html$ /teachers/megan.php
RewriteRule ^university.html$ /university.php
RewriteRule ^university-contact.html$ /university-contact.php

Open in new window

0
Comment
Question by:Victor Kimura
2 Comments
 
LVL 10

Assisted Solution

by:honestman31
honestman31 earned 250 total points
Comment Utility
in the each sub domain you want to redirect  go to folder www.domain.com/sub1/

and insert the following codes in htaccess  file  

redirect 301 / http://domain.com/.

copy that htaccess to every folder of the sub-domain you want to redirect
i.e  www.domain.com/sub2/
and www.domain.com/sub3/

and so on
0
 
LVL 26

Accepted Solution

by:
arober11 earned 250 total points
Comment Utility
If you just want a 301 rather than a 302 redirect simply add a [R=301] to the end of you rule. e.g.

RewriteRule ^teachers/don.html$ /teachers/don.php [R=301]

If you what to control the hostname seen in the browser just add it to the destination e.g.

RewriteRule ^teachers/don.html$ http://omusicstudios.com/teachers/don.php


If you have some other requirement then please set out what you are trying to achieve in the format detailed in the "How to define your own Redirects or Rewrites: " section of this article: http://www.experts-exchange.com/A_4043.html then post it back here.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now