Answer the question
In order to leave comments, you need to log in
RewriteRule for all subdomains, how to implement?
Good afternoon!
I am trying to configure the CNC in the apache2/sites-available/domain.ru.conf file for all subdomains for links of the form:
http:// * .domain.ru/somePageName.html → http:// * .domain.ru/?page= somePageName I write
directives:
RewriteCond %{REQUEST_URI} !([^/]*)\.html/$
RewriteRule ^/([^/]*)\.html$ /?page=$1 [L]
I get results:
subdomain.domain .ru/news.html/?page=news
subdomain.domain.ru/questions.html/?page=questions
What am I doing wrong? Thank you.
Answer the question
In order to leave comments, you need to log in
Hello,
if we talk about those directives that you wrote, then you do not need RewriteCond, because the regex in RewriteRule covers it. In the RewriteRule, you need to remove the leading slash and specify the file where the data is transferred.
RewriteEngine On
RewriteRule ^([^/]+)\.html$ index.php?page=$1 [L]
<?php
print_r($_REQUEST);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question