S
S
ShagolChannel2022-01-04 12:18:33
PHP
ShagolChannel, 2022-01-04 12:18:33

How to use php to make many different pages from 1 template page?

Let's say there is an index.php file at the root of the directory. You can access this file by the conditional link site.ru. How can I make it using php so that when I go to the site.ru/second site, I get an index.php page with data taken from the subd?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2022-01-04
@ShagolChannel

# .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([^?]+) index.php?%{QUERY_STRING}&p=$1 [L]

<?php // index.php
echo $_GET['p'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question