?
Solved

simple htaccess RewriteEngine question

Posted on 2007-11-29
2
Medium Priority
?
555 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
[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 43

Accepted Solution

by:
ravenpl earned 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

764 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