S
S
Schoolboy.2015-09-27 11:05:32
PHP
Schoolboy., 2015-09-27 11:05:32

How to make CNC on the site?

How to change all URLs. For example: site.ru/article.php on site.ru/article
I tried to write in .htaccess:

RewriteEngine On
RewriteRule ^([a-z]+)/$ $1.php [L]

Does not work!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Schoolboy., 2015-09-27
@viphorizon

RewriteRule ^([a-zA-Z0-9]+)/? $1.php [L]

M
Marcuzy, 2015-09-27
@Marcuzy

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

  1. Make sure the apache rewrite module is enabled
  2. With this .htaccess file example, all requests will look like index.php/request
  3. How to extract the part after index.php in PHP php.net/manual/ru/reserved.variables.server.php (PATH_INFO)
  4. You also need to make sure that .htaccess files are allowed in the site directory, you need to stick, for example, in the host config:
    <Directory /var/www/domain/web/>
     Options Indexes FollowSymLinks
     AllowOverride All
     Require all granted
    </Directory>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question