0

I'm trying to write my mod_rewrite rules in my .htaccess file to fix the URL that shows up in the browser bar when visitors to to my site. I have a few options that I want my users to be able to enter. They should be able to enter something like:

aaa.xxx.yyy.edu
bbb.xxx.yyy.edu

and it should forward to

bbb.org

where bbb.org is a URL that I own that's pointing to the site now. I've already got a rule that removes www. from the front of either of those, and I have a rule that will forward aaa.xxx.yyy.edu to bbb.xxx.yyy.edu, but if you go to bbb.org, the URL in the browser bar shows up as bbb.xxx.yyy.edu.

Any suggestions?

0
<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{HTTP_HOST} ^(www\.)?(aaa|bbb)\.xxx\.yyy\.edu$ [NC]
  RewriteRule ^(.*)$ http://bbb.org$1 [L,R=301]
</IfModule>
1

Use Redirect instead:

Redirect Permanent / http://bbb.org/

Put this inside a vhost that responds to both the hostnames:

<Virtualhost *:80>
 ServerName aaa.xxx.yyy.edu
 ServerAlias bbb.xxx.yyy.edu
 Redirect Permanent / http://bbb.org/
</Virtualhost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.