E
E
Evgeny Bukharev2015-03-12 12:10:35
Apache HTTP Server
Evgeny Bukharev, 2015-03-12 12:10:35

How to redirect subdomain to admin.php entry point?

Good afternoon,
I have an admin panel with an entry point example.com/admin.php
How do I set up .htaccess so that the admin.example.com subdomain is directed to admin.php ?
In the settings of the main domain example.com, the subdomain admin.example.com is specified as ServerAlias
​​I tried this:

# RewriteEngine
<IfModule mod_rewrite.c>

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REMOTE_HOST} ^admin.*
RewriteRule . admin.php[L]

# otherwise forward it to index.php
RewriteRule . index.php

</IfModule>

Doesn't work, index.php opens, but style files and others don't display
Thanks for your help :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
IceJOKER, 2015-03-12
@IceJOKER

Not sure, but:

RewriteCond %{HTTP_HOST} ^admin
RewriteRule . http://example.com/admin.php[L]

S
ShamblerR, 2015-03-12
@ShamblerR

soon somehow

RewriteCond %{HTTP_HOST} ^www\.admin.example\.com [OR]
        RewriteCond %{HTTP_HOST} ^admin\.example\.com
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !admin.php$
       RewriteRule ^(.*)$ /admin.php [L]

M
Matvey Pravosudov, 2018-01-05
@musclecode

Well, if in a simple way, then two tables.
In the language table, we store IDs (PK) and the names of available languages. In the table of values, we store the value for the phrase, its id (PK) and language id (FK) . Communication is one-to-many, the database is normalized according to 3NF. When adding the language/meaning of the phrase, the number of tables will not grow.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question