0

I need to redirect following url

admin.example.us

to

myadmin.example.us

I have tried different examples using RewriteBase, RewriteRule, RewriteCond. Nothing quite fits my case and my regex seems to fail.

Thank you for your help

MANOJ GOPI
  • 1,279
  • 10
  • 31
Jack Longen
  • 51
  • 3
  • 11

1 Answers1

1

You can use this .htaccess:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^admin\. [NC]
RewriteRule ^ http://myadmin.example.us%{REQUEST_URI} [NE,L,R=301]
Croises
  • 18,570
  • 4
  • 30
  • 47
  • Thank you for your answer, my own solution finally was RewriteCond %{HTTP_HOST} ^admin\.example\.us$ [NC] RewriteRule ^(.*) myadmin.example.us/index.php/admin [L,R] Neither seems to work atm since there's some other issue. – Jack Longen Feb 03 '15 at 10:31
  • If you just copy-paste all and only my answer, it works. You can have problem to [enable mod_rewrite](http://stackoverflow.com/questions/3131236/how-do-you-enable-mod-rewrite) – Croises Feb 03 '15 at 10:48
  • Actually, when I started to see what's wrong, I found that the server is not on Apache - the problem is that Nginx doesn't use .htaccess files... my solution was to use AWS bucket and alias to redirect. – Jack Longen Feb 06 '15 at 08:34