Solved

simple htaccess RewriteEngine question

Posted on 2007-11-29
2
530 Views
Last Modified: 2013-12-08
Currently I am using this

RewriteEngine on
RewriteCond %{HTTP_HOST} ^hello.xxx.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.hello.xxx.net$
RewriteRule ^(.*)$ http://www.xxx.net/hello$1 [R=301,L]

This will redirect my visitors even they have typed in http://hello.xxx.net/anything
I only wish to redirect "hello.xxx.net", but not http://hello.xxx.net/WHATEVER

Whats the correct code?
Thanks
0
Comment
Question by:LearningLearning
2 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 total points
ID: 20372878
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^hello.xxx.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.hello.xxx.net$
RewriteRule ^$ http://www.xxx.net/hello [R=301,L]
#last rule says, that redirection should trigger only if there's nothing except "/" in url path
0
 

Author Closing Comment

by:LearningLearning
ID: 31411616
excellent
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
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). #…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.

705 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

15 Experts available now in Live!

Get 1:1 Help Now