Rewrite rule question for subdomain

Posted on 2008-06-18
Medium Priority
Last Modified: 2010-03-04

For my domain www.1cyu.com, I created a subdomain from the control panel of my provider. BNow I have www.cnn-news.1cyu.com redirected to www.1cyu.com/cnn-news

I would like the url displayed in the browser to be www.cnn-news.1cys.com
It is still displayed www.1cyu/cnn-news/index.php when I type www.cnn-news.1cyu.com

I am trying the following rewrite rule without luck.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?1cyu\.com
RewriteRule ^/cnn-news/?(.*) http://cnn-news.1cyu.com/$1 [R=301,L]

Question by:ornicar
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
LVL 32

Expert Comment

by:Kamran Arshad
ID: 21819490

Ask your provider if there is an A record for "cnn-news.1cyu.com" in the zone file. There should be a separate A record for your above subdomain like below:

1cyu.com                      IN A      
cnn-news.1cyu.com      IN A      
LVL 16

Accepted Solution

Blaz earned 500 total points
ID: 21819772
You are trying to fix things on www.1cyu.com site which is in my opinion wrong.

You should first (and only) fix the www.cnn-news.1cyu.com site that it won't redirect to www.1cyu.com. Contact your provider on how to do that - it seems that what you configured now is not correct. Without knowing your configuration interface at the provider we can't help much other than general guidelines.

It seems that you configured the domain www.cnn-news.1cyu.com to redirect to www.1cyu.com/cnn-news. This is wrong. You should have configured a new web site that points to the same folder on the disk or create a server alias which would result in an address of www.cnn-news.1cyu.com/cnn-news

Author Comment

ID: 21821901
Thanks to pointing to my mistake.

The config interface is Confixx Pro, in which I defined this:

1cys.com    --->   /   (root dir)
www.1cys.com ---->  / (root dir)
www.cnn-news.1cys.com ---> www.cnn-news.1cyu.com/cnn-news (WRONG)

I suppose the first two are ok, and that I don't need any rewrite rule. Cool!
I corrected the third entry to
www.cnn-news.1cys.com ---> /cnn-news
and it works fine. Thank you very much for your help..


Author Comment

ID: 21821930
I meant www.cnn-news.1cyU.com :)

Featured Post

Supports up to 4K resolution!

The VS192 2-Port 4K DisplayPort Splitter is perfect for anyone who needs to send one source of DisplayPort high definition video to two or four DisplayPort displays. The VS192 can split and also expand DisplayPort audio/video signal on two or four DisplayPort monitors.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 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