Beginner at .htaccess mods and handling pretty URLs.
I have a php/bootstrap/mysql/javascript page: http://localhost/modules/posts/questions_all.php.
I would like to redirect pages like http://localhost/modules/posts/questions_all.php/1234 to the original page.
I have modified the .htaccess file as such.
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^modules/posts/questions_all.php/?$ modules/posts/questions_all.php [NC,L]
It seems to redirect to the original page but produces some type of endless javascript loop which appends portions of the code over and over again creating a mess of a page.
In the Chrome console inspector, I get this error which does not occur in the normal load of the page. But with /1234 at the end of the URL, the Error is:
DevTools failed to parse SourceMap: http://localhost/modules/posts/questions_all.php/bootstrap.min.js.map
[Violation] Forced reflow while executing JavaScript took 32ms
The request for the SourceMap did NOT occur with the original page, which functioned perfectly without console errors.
This seems to happen in firefox as well, so I don't think it is a matter of turning off the SourceMap feature in the Chrome Inspector? With the Chrome inspector NOT engaged, I still get this problem.
I have used the same approach for htaccess mods to other similar pages (with bootstrap) for pretty URLs, but I do not get that error and they function fine, but not this page...!
Thank you in advance!
[EDIT]: the found issue is somehow related to an infinite scroll piece of code, but still am not sure why I get an infinite loop. Purpose of code is to continuously load data until the bottom of the screen is reached, then stops. It works fine without the /1234 added to the URL, but when /1234 is added, it seems to go into an infinite loop and causes other parts of the code to execute as well.
The load_data function is an AJAX call to retrieve data.
Code below:
//autoload portion. when scrolling reaches the bottom of the screen, triggers another load of data
$(window).scroll(function(){
if($(window).scrollTop() + $(window).height() > $("#load_data").height() && action == 'inactive'){
action = 'active';
start = start + limit;
setTimeout(function(){
load_data(limit, start, search, tag);//recursive loading function
}, 500);
}
});