Answer the question
In order to leave comments, you need to log in
How to check for the presence of a file using .htaccess?
Community, please help.
It is necessary to build such a rule using .htaccess.
If the requested (via URL) file does not exist at the specified path, but it is in the xxx folder, then return (redirect to it) to the xxx folder, otherwise (when it is not found either at the requested path or in the xxx folder) redirect to index.php
How to combine all this into a working solution - I will not master. Thoughts move in the following direction:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
Answer the question
In order to leave comments, you need to log in
Maybe RewriteCond /folder/%{REQUEST_FILENAME} -d
? And action accordingly.
Enlightenment is starting to come. The standard mechanism that maxaon advised works fine from the root of the domain. But it doesn't work from a subfolder, because %{REQUEST_FILENAME} contains the path from the domain root, and not from the current folder in the user's browser.
And for the request
mysite.ru/workdir/xxx/1.html
with the current workdir directory, the value of the
REQUEST_FILENAME variable is equal to workdir/xxx/1.html
But in order for the request to be processed correctly, REQUEST_FILENAME must be equal to 1.html Using the AcceptPathInfo OFF directive did not give anything .
PS. Under the current directory we mean the one in which htaccess lies.
If the button does not come with ajax response
var page = 1;
var per_page = 20;
jribbble.getShotsByList('popular', callback, {page: page, per_page: per_page});
$('.btn_p').click(function(){
jribbble.getShotsByList('popular', callback, {page: ++page, per_page: per_page});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question