P
P
povisok_dmitriy2017-07-18 14:44:21
PHP
povisok_dmitriy, 2017-07-18 14:44:21

How to pull 2 ​​GET variables when using CNC?

Such a disaster. I took up this difficult task, which is called cnc, and ran into the following problem:
there is a code in .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [ R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^gorod/(.*)$ city.php?city=$1 [L]
RewriteRule ^gorod/(.*)/ (.*)$ search.php?city=$1&value=$2 [L]
In the case of RewriteRule ^gorod/(.*)$ city.php?city=$1 [L] - everything works out clearly, I pull out the $_GET[ 'city'] and happy (I'm pulling out the city conditionally moskva ) !
But with RewriteRule ^gorod/(.*)/(.*)$ search.php?city=$1&value=$2 [L] - it doesn't work, it puts both variables into the $_GET['city'] variable, it does not break (it turns out something like: moskva/pememennaya2 ), and the second variable generally turns out to be not. What to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2017-07-18
@povisok_dmitriy

RewriteRule ^gorod/([^/]*)/(.*)$ search.php?city=$1&value=$2 [L]

P
povisok_dmitriy, 2017-07-18
@povisok_dmitriy

The problem is gone. Both options helped in the aggregate, it did not work separately! Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question