i am going to redirect my domain to specific path.
thing that i want is
admin.example.com to admin.example.com/admin
partner.example.com to partner.example.com/partner
I need this two function in one .htaccess file. Thanks.
i am going to redirect my domain to specific path.
thing that i want is
admin.example.com to admin.example.com/admin
partner.example.com to partner.example.com/partner
I need this two function in one .htaccess file. Thanks.
Assuming admin.example.com
and partner.example.com
point to the same place on the filesystem, then in the document root try the following (mod_rewrite directives) at the top of your .htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(admin|partner)\.example\.com$ [NC]
RewriteRule !^(admin|partner) http://%{HTTP_HOST}/%1 [R=302,L]
This will redirect just the two specific URLs as stated in your question, namely:
http://admin.example.com/
to http://admin.example.com/admin
http://partner.example.com/
to http://partner.example.com/partner
Change the 302
(temporary) redirect to 301
(permanent) when you are sure it is working OK - if this is to be a permanent redirect. (302s are easier for testing, since they won't be cached by the browser.)