S
S
s2sk13372017-04-05 22:01:09
htaccess
s2sk1337, 2017-04-05 22:01:09

How to do a proper htaccess redirect (XAMPP)?

UPD Closed. Figured it out myself.
I want to make sure that absolutely all requests are redirected to index.php, and they are already processed there, but for some reason, if you enter, for example, the request site.ru/page/page1.php, then it will simply bypass processing in index.php and open directly this page. If you enter even some wrong request, then it bypasses index.php again and directly gives a server error "Object not found!", Although I simply redirect to the main page in my index.php. Tell me what to do. Here is the HTACCESS content:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

I use XAMPP, if I wrote something like this in the settings:
Os5k8B2HMmU.jpg
In the Windows hosts file, I also registered redirection from the domain to the LAN.
By the way, can you advise some other local server, Denver is not suitable, the PHP version is too old there. I know that you can update it by replacing some files, but after that it either crashes for me, or there are a lot of errors at startup.
PS And if you enter some nonsense in htaccess, it will give an error 500, so the htaccess file still works .... But why doesn't it redirect ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-04-06
@shambler81

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !page/page1.php$
RewriteRule .* index.php [L]

Denial!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question