R
R
Ruslan2014-05-18 20:39:08
htaccess
Ruslan, 2014-05-18 20:39:08

How to replace a file that doesn't exist in htaccess?

Subject, is it possible to make the user go to the address:
site.ru/file.docx
if the file is not found, he will be shown another file but all under the same link?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Solovyov, 2014-05-18
@pavel_salauyou

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^file.docx$ /file.txt [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question