R
R
Regina Khairullina2019-03-27 18:52:49
URL Handling
Regina Khairullina, 2019-03-27 18:52:49

How to set up a self-written CNC for a site in php?

There is a page site.ru/complex/contact.php
It is necessary that the page opens by the link site.ru/contact
I'm trying this, but it doesn't work, I don't understand how it works. Help those who know please
I write in the .htaccess file (the file is at the very root)

RewriteEngine on
RewriteRule ^contact/$ pages/contact.php[L]

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
ThunderCat, 2019-03-27
@ThunderCat

Correct:
1) redirect all urls to the index (create a single entry point)
2) connect the router in the index
3) process the url in the router (for example, split it into slashes and see what you got)
as the easiest option - make an array in the router in the same place matches URLs to plug-ins and check if there is such a key URL in the list and what to connect in this case.
4) Profit
1) Use .htaccess to connect individual files, otherwise dump everything into a bunch of files "as is"
2) Insert your own index.php in each folder and steer from it with all left movements
3) Other perversions in stock

D
Dmitry, 2019-03-27
@By_Engine

RewriteRule ^contact/?$pages/contact.php[L]

A
Antonio Solo, 2019-03-27
@solotony

contact
and
contact/
are different URLs
I would write
RewriteRule ^contact(.*)$ pages/contact.php[L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question