KTM
KTM

Reputation: 868

Basic redirect with htaccess

I want to redirect the url of sample.mysite.com to

mysite.com/shops/index/sample.mysite.com . How can i do this using

.htaccess rules ?

Note : Here sample can be a variable ..

Upvotes: 0

Views: 19

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You can use the following rewriteRule

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sample\.mysite\.com$
RewriteRule ^ /shops/index/sample.mysite.com%{REQUEST_URI} [L,R,NE]

This will internally forward sample.mysite.com to mysite.com/shops/index/sample.mysite.com with the requested uri.

Upvotes: 1

Related Questions