N
N
Nastradamus2013-09-04 18:08:17
linux
Nastradamus, 2013-09-04 18:08:17

Redirect to subdomain folder via RewriteRule

Good afternoon.

There is a /market directory at the root of the website,

you need to make requests to market.site.com go to site.com/market , but not as a redirect, but so that the market.site.com domain remains

RewriteBase /
  RewriteCond %{REQUEST_URI} !^/market
  RewriteCond %{HTTP_HOST} ^market.site.com$ [NC]
  RewriteRule ^(.*)$ /market/$1 [L,QSA]


In this case, index.php opens correctly if the browser opens market.site.com .
But queries like market.site.com/index.php?productID=115 do not work

. All this happens on the Bitrix CMS.

Help, please, to solve the problem. It seems simple, but it doesn't work.

Thanks in advance!

UPD. The problem was solved like this:

  RewriteBase /
  RewriteCond %{REQUEST_URI} !^/market
  RewriteCond %{HTTP_HOST} ^market.site.com$ [NC]
  RewriteRule ^index\.php(.*)$ /market/$1 [L,QSA]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Margelov, 2013-09-05
@smargelov

This is how I always do it.

RewriteEngine On


RewriteRule ^market/ - [L]
RewriteCond %{HTTP_HOST} ^market\.site\.ru$
RewriteCond %{DOCUMENT_ROOT}/market%{REQUEST_URI} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R,L]
RewriteCond %{HTTP_HOST} ^market\.site\.ru$
RewriteRule (.*) market/$1 [L,QSA]


RewriteRule ^market/ - [L]
RewriteCond %{HTTP_HOST} ^www\.market\.site\.ru$
RewriteCond %{DOCUMENT_ROOT}/market%{REQUEST_URI} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R,L]
RewriteCond %{HTTP_HOST} ^www\.market\.site\.ru$
RewriteRule (.*) market/$1 [L,QSA]

N
Nastradamus, 2013-09-04
@Nastradamus

No, you need to work on the same CMS.
The solution has already been found - I wrote in a post with a question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question