S
S
Sergey Burduzha2017-09-19 22:43:53
Apache HTTP Server
Sergey Burduzha, 2017-09-19 22:43:53

Why doesn't RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] work?

Here is the content of the .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

Options +FollowSymlinks
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

In the index.php file, which is located next to the
var_dump($_GET)
browser, it displays
/var/www/test.site/public_html/doctype/post/index.php:3:
array (size=0)
  empty

but should
array (size=1)
  'url' => string ''

I found part of the solution on this site www.cyberforum.ru/apache/thread652774.html
it says what needs to be added
Options +FollowSymlinks
But it still doesn't work.
It is noteworthy that if I enter test.site/doctype/post/controller/action
into the browser line, then it displays
/var/www/test.site/public_html/doctype/post/index.php:3:
array (size=1)
  'url' => string 'controller/action' (length=17)

What else did I miss?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2017-09-20
@serii81

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?url\=$1 [L,QSA]
Options +FollowSymlinks

A
Alexey S., 2017-09-20
@Winsik

why do you put a delimiter on the existence of folders and files?
now you will only redirect if the file/path does not exist

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question