How to make a CNC through.htaccess or other method

Hello, tell me how to do ЧПУ via .htaccess or another way. At the moment, I'm trying to implement it via .htaccess, but something is wrong.

The situation is such that I use one entry point through index.php, maybe it somehow affects.

Here is .htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^([a-z]+)/([a-z]+)/$ ?country=$1&region=$2&city=$3 [QSA,L]
RewriteRule .* index.php [L]
Author: Kyubey, 2017-12-29

2 answers

If you already have a single entry point (this is good) and there is no dependency on .htaccess (this is good), then do not add a dependency on .htaccess and lose the advantages of a single point of entry: all routing in one place, independence from the server.

Parse your URL directly in index.php.

Read more: How do I do everything at once in mod_rewrite?

P.S. I can't close the question under the contest as a duplicate.

P. P. S. I don't remember anything about .htaccess, but in your in the code, it seems, the problem is that all the transformations are hung on one condition.

 4
Author: Kyubey, 2018-01-04 17:32:54

. htaccess is passed again if there were changes to the query string by conditions.

Be careful with .*, otherwise all requests will end up there. You can use [END] to stop the re-pass. [L] stops parsing, but does not cancel the re-pass

 0
Author: DNS, 2018-01-06 16:41:19