M
M
maxhd2019-11-30 01:13:22
htaccess
maxhd, 2019-11-30 01:13:22

How to do a 404 redirect to SPA?

Guys, how can I make SPA redirect to /#/404 except for the main one if there is no backend?
Here's what's there:

ErrorDocument 404 /#/404
# Манипуляции над URL
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    # Перенаправляем на https
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    # Переадресация с index.html на /
    RewriteRule ^index\.html$ / [R=301,L]
    # Удаляем www из url
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>

It only comes to mind to make a single entry point in index.php and already there to determine, if not the main one, then redirect to /#/404

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antokha, 2019-11-30
@ru027

RewriteRule ^/asd, /asd/asd/(.*)$ /#/404/$1 [L,R=301]
or
RewriteRule ^/asd, /asd/asd/(.*)$ /#/404.php $1 [L,R=301]
more details here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question