?
Solved

301 redirect htaccess subdomain pages to main page

Posted on 2010-11-08
2
Medium Priority
?
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Assisted Solution

by:honestman31
honestman31 earned 1000 total points
ID: 34088273
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 1000 total points
ID: 34088312
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 MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
What You Need to Know when Searching for a Webhost Provider
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 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