I am creating a one page application. When the user changes the url, or reloads, anything after "mysite.com/" is sent as a variable to ajax the requested subdirectory content (e.g. /users/me)
This code works great when the relative url has only one "sub-directory". But sub-sub-directories, and even simply "sub-directory/", receive errors and load no content.
- mysite.com/sub_directory -------------------------- navigates to mysite.com/index.html
- mysite.com/sub_directory/ ------------------------- throws error
- mysite.com/sub_directory/sub-sub-directory --- throws error
Resource interpreted as Stylesheet but transferred with MIME type text/html: "mysite.com/all/default.css"
Resource interpreted as Script but transferred with MIME type text/html: "mysite.com/all/jquery.js"
htaccess attempt: redirect anything after "mysite.com/" to index.html.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]
Additional info:
.* and (^/?.$) and (^./$)* and .*/ etc. produce the same results
including the AddType rules for .css and .js files seems to do nothing.
The htaccess file sits in the same folder as index.html
Is this a regex problem? Usually when there is a problem with the htaccess code, the server responds with a 500 internal server error, but in this case no content is loaded and the above error is thrown.
UPDATE: I have a bunch of scripts that are in a "scripts" folder, which is on the same directory-level as index.html and .htaccess. They all load without error, perhaps the problem is that .htaccess is not applying to the files in its own directory-level?