A
A
Alexey Anisimov2016-03-19 13:02:42
symfony
Alexey Anisimov, 2016-03-19 13:02:42

How to set up htaccess so that one page of the site opens on a sub-domain, and the rest on the domain?

Good afternoon.
There is a site on the symfony 3 framework.
Tell me what you need to write in htaccess (or somewhere else) so that one page of the site opens on a sub-domain, and the rest on the domain.
Example:

  • the news list page should open on the sub-domain news.site.ru
  • The rest of the pages are like this site.ru/page1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalyabus, 2016-03-19
@kalyabus

nginx:

server {
   listen 80;
   server_name news.site.ru;
   ...
}
server {
    listen 80;
    server_name site.ru news.site.ru;
    ...
    location /news {
        rewrite ^/news/(.*)$ http://news.site.ru/$1 permanent;
    }
}

.htaccess (may be wrong, but something like):
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} ^/news/.*$
  RewriteRule ^/news/(.*)$ http://news.site.ru/$1 [R=301,L]
</IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question