A
A
Artur Lastname2019-11-06 11:10:47
htaccess
Artur Lastname, 2019-11-06 11:10:47

How to make two different htaccess for local server and combat one?

The task is to load different rules for the local and combat servers.
Either somehow configure 2 different htaccess in docker depending on the environment (unfortunately, I’m not very good at docker yet), or somehow by means of htaccess itself.
Another small problem is that the site itself is already divided into 3 subdomains inside htaccess, i.e. of course, you can do it like this, i.e. commenting on the unnecessary part, but every time uncommenting when deploying or assembling a container on someone's machine, this is not great.

# Development

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ /app/index.php?request=$1 [L,QSA]

# Staging

# RewriteEngine on
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} !=/favicon.ico
# RewriteRule ^(.*)$ /html/app/index.php?request=$1 [L,QSA]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2019-11-06
@vitaly_il1

You need to generate (or choose from templates) htaccess in the deploy process, depending on the target.
This can be done either with a simple shell script, or based on Ansible / Chef / Puppet and other fancy stuff.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question