A
A
AlexRas2016-02-19 11:40:09
PHP
AlexRas, 2016-02-19 11:40:09

How to set up the CNC without taking into account the directory?

Hello, there are addresses
site.ru/category1/?pages=top
site.ru/category2/?pages=top
site.ru/category3/?pages=top
etc.
How to turn it into a link of this type
site.ru/category1/link/top.html
site.ru/category2/link/top.html
site.ru/category3/link/top.html
If you do this in htaccess:

RewriteRule ^category1/link/([^/]*).html$ category1/?pages=$1 [L]
RewriteRule ^category2/link/([^/]*).html$ category2/?pages=$1 [L]
RewriteRule ^category3/link/([^/]*).html$ category3/?pages=$1 [L]

it works, but how to make it all one line?
So I tried:
RewriteRule ^link/([^/]*).html$ ?pages=$1 [L]
it does not work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Georgy Eremeev, 2016-02-19
@AlexRas

RewriteRule ^category(\d+)/link/([^/]*).html$ category$1/?pages=$2 [L]

A
Alexander Sharihin, 2016-02-19
@Pinsky

Use a software router.
As an example -
https://github.com/nikic/FastRoute

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question