Solved

301 redirect htaccess subdomain pages to main page

Posted on 2010-11-08
2
423 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
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 250 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parse convert xml feed to text (python) 2 67
nagios 4 php error after installation 6 73
networking details on centos 6.6 4 49
Coding C# in Linux 8 21
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

914 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

14 Experts available now in Live!

Get 1:1 Help Now