Answer the question
In order to leave comments, you need to log in
What is the best way to implement url processing?
Good night!) I don’t even know how to describe the problem that I came up with myself)))
In a nutshell - I wanted a site with dynamic content loading via ajax, while I wanted to hide the real url addresses where the request is sent.
As a result, I send all requests to one Php file through the js function, the name variable is passed in the request, depending on what value this variable contains, the address of the handler is formed and it is pulled up through include to process the request.
Links have an appearance site.ru/page1
while the real address site.ru/pages/page1.php
Through jquery.history I try to somehow manage this disgrace. Everything works, it goes back and forth, everything is fine until you refresh the page. Naturally, a 404 error ... I didn’t do any htaccess settings, because I don’t know how )))
The question is: what is the best way to solve the problem? So far, only one option comes to my mind that I can implement with my knowledge. Parse the url using php and follow the old pattern. But it seems to me that there is another way, perhaps just through htaccess?
site.ru/page1/cat
It will NOT, but links can drag 2-3 variables with them. I haven’t reached this point yet, so I’m at a loss to say what they will look like, or rather, what separator will be used after the main url, I think it’s like or there will be something else site.ru/page1?dt_begin=.......&dt_end=.......
instead !? ?
for example :
?! But that's another question...Answer the question
In order to leave comments, you need to log in
I did it, everything is ok, maybe it will be useful to someone ...
RewriteEngine On
RewriteBase /pages
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ^([^.]+)$ $1.php [NC,L]
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php
mod_rewrite for Apache, and instructions for creating CNC (human-readable urls)
tyts and tyts
I wanted to hide the real url addresses where the request is sent.it doesn't make any sense.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question