D
D
deSoul2015-11-27 13:56:45
PHP
deSoul, 2015-11-27 13:56:45

How to implement CNC?

Can you please tell me how to implement CNC on self-written CMS? The idea is that pages are always opened via index.php via a GET request, for example: index.php?action=pages&category=animals&article=123.
I want to implement the following scheme: Hide index.php from SEF System GET variables "hardcode", eg. pages, category And dynamic, such as the title of the article, to be written in the article itself and taken from there (with an understanding of the "where" the trouble comes from - I don't understand how .htaccess will take my "custom" link value from the article), the result: mysite.com/pages/ category/animals/my-custom-sef-article-name
Can't find an example. Help.
PS: I saw something similar in Joomla a long time ago

Answer the question

In order to leave comments, you need to log in

5 answer(s)
6
65536, 2015-11-27
@65536

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ /index.php?route=$1 [L]

S
Sergey, 2015-11-27
Protko @Fesor

https://github.com/nikic/FastRoute

S
Seva, 2015-11-27
@Zewkin

Google for modRewrite

M
Mark Doe, 2015-11-28
@mourr

www.phpinfo.su/articles/practice/chpu_na_php.html
Cool article, universal approach without mod_rewrite

V
Vadim, 2015-12-03
@kylt_lichnosti

It seems to me that it is better to take some kind of microframework - Slime or Silex. There and routing is and still any nishtyaki. Documentation again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question