K
K
killerben2021-12-31 15:17:50
htaccess
killerben, 2021-12-31 15:17:50

Htaccess: How to set custom rules for a subdomain?

Please tell me, according to the rules of htaccess.

It is necessary that when opening podomen.site.ru, index.php opens, say, and when podomen.site.ru/news/6431/ the request is to index2.php

Something like this, but it doesn’t work for me:
RewriteCond %{HTTP_HOST} ^( .*)\.site\.ru/news/$
RewriteCond %{REQUEST_URI} !/(.*)/
RewriteRule ^(.*)/$ /index2.php?newsid=$1 [L]

or like this:
RewriteCond %{ HTTP_HOST} ^(.*)\.site\.ru$
RewriteRule ^news/(.*)/$ /news1.php?newsid=$1 [L]

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rafael™, 2015-09-10
@krutdev

the classic answer to this question is flanagan's book and javascript.ru

A
Anatoly Rodin, 2015-09-10
@Anatoly_Rodin

Hey!
I'm currently learning JS from these resources:
1. codecademy
2. learn.javascript.ru
3. David Flanagan - JavaScript. Detailed guide.
Good for a start.
Good luck)

V
Viktor Korolev, 2015-09-10
@VictKor

Make it easier. Set yourself a practical challenge. You will learn as you go. And reading books, articles on a theoretical level is a waste of time.
And yes, you should not put something very simple. The task should be moderately difficult, and most importantly interesting and useful. There must be an incentive.

U
Ulugbek, 2017-04-24
Tuychiev @Ula_T

I recommend paying attention to the hexlet.io educational project. Here you will find a complete training program for frontend and backend development

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question