N
N
nubochistka2019-02-14 16:03:18
Apache HTTP Server
nubochistka, 2019-02-14 16:03:18

rewrite not working in .htaccess apache 2.4?

Hello everyone, I've run into this problem. It is necessary to make it so that when a request is made to "some-site.com/blog/" a redirect is made to "some-site.com/blog" and index.php is opened in this folder. I did this using the apache config and the .htaccess file for this folder. But you need to transfer everything to the .htaccess file, and for some reason, when transferring rewrite rules to .htaccess, they are not accepted. The redirect instructions apply, but the rewrite instructions do not. Can anyone help?
apache config file:
_______________________________________________________________
ServerAdmin [email protected]
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteRule ^/blog$ /blog/index.php
SetHandler "proxy:unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/"
DirectoryIndex index.php
____________________________________________________________
.htaccess file:
____________________________________________________________
Options +FollowSymLinks
DirectorySlash Off
RewriteEngine On
RedirectMatch ^/blog/$ /blog
_____________________________________________________

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-02-14
@nubochistka

Options +FollowSymLinks
DirectorySlash Off

RewriteEngine On

RewriteRule ^blog/$ /blog [R=301,L]
RewriteRule ^blog$ /blog/index.php [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question