T
T
TANK_IST2014-06-07 15:41:10
Apache HTTP Server
TANK_IST, 2014-06-07 15:41:10

Subdomains, CNC and mod_rewrite?

I need that when I go to a link, for example music.site.ru/article/trance, mod_rewrite transfers everything except existing files to index.php.
The CNC on the site is already working for me. How to add another subdomain replacement there?
My .htaccess

AddDefaultCharset UTF-8
AddType audio/mpeg mp3
AddType audio/mp4 m4a
AddType audio/ogg ogg
AddType audio/ogg oga
AddType audio/webm webma
AddType audio/wav wav
AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} \.(mp3|torrent)$
RewriteRule ^.*$ down.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(favicon.ico)$
RewriteRule ^.*$ index.php [L,QSA]

Options -Indexes -ExecCGI -Includes

<ifModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Logachev, 2014-06-07
@TANK_IST

RewriteCond %{HTTP_HOST} ^([^\.]+)\.toster\.ru[NC]
RewriteRule ^/?(.*) http://%2/%1/$1 [L,R=301]

Here's an example of a redirect that should throw a URL like subdomen.toster.ru/q/101167 to toster.ru/subdomen/q/101167
I can't guarantee that I didn't make a mistake, but I hope you understand the idea?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question