A
A
Alexey2016-04-21 09:27:49
JavaScript
Alexey, 2016-04-21 09:27:49

PE URL on jQuery, perhaps?

Everyone, good day!

I am making a website where pages are updated without reloading.
All links are in the format domain.ru/folder1/folder2/.../folderN/
This address format allows you to use "infinite" nesting of folders. But there is a problem, when you press F5, there is a transition to the corresponding page of the site, which is not there, because. all work is done in index.php.
I did a redirect (in .htaccess) of all requests to index.php, but this did not give a result (most likely I didn’t do it correctly).

Q1: How can I make it so that when I press F5, a redirect to index occurs, and in it I can already parse the url?

I am considering another option for passing folders through variables: index.php?folder=1&folder=20&folder=33&...&folder=N
But here the problem will be that all folder variables, as a result, will be equal to N. The number of nested folders, in theory, is infinite.

Q2: If we consider this option, then how to make it possible to pass such nesting through variables?

So far, the only solution that came to mind is the use of cookies. But I would like to do it through the address so that there is a visual representation and you can move through the browser history.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2016-04-21
@healqq

You need to do 2 things: 1 - redirect to index.html on the server
2. initialize your router on initial page load and load the required template according to the URL.

T
trevoga_su, 2016-04-21
@trevoga_su

when you press F5, you go to the corresponding page of the site, which is not there, because. all work is done in index.php
catch request_uri in index.php and dance from it in your JS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question