S
S
Serhio Seal2016-04-21 23:03:11
htaccess
Serhio Seal, 2016-04-21 23:03:11

What is the correct way to write mod_rewrite for SPA?

How to correctly write a rule for .htaccess so that when you access a link of the form
/pages/page1/(any combination can be) a file is opened app/index.html, and if there is a parameter at the end, ?_escaped_fragment_=then open the page `snapshot/pages/page1/index.html`
For example
/page-test
Leads to
app/index.html
A if
For example
/page-test?_escaped_fragment_=
Leads to
snapshot/page-test/index.html
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2016-04-22
@shambler81

RewriteCond %{QUERY_STRING} (^|&)_escaped_fragment_=($|&)
RewriteRule ^(.*)$ /app/index.html? [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question