Write a rule in .htaccess to avoid “Resource interpreted...

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Write a rule in .htaccess to avoid “Resource interpreted...

Postby bart83 » 17. May 2015 17:43

Actually i asked the same question here :
http://stackoverflow.com/questions/30289163/write-a-rule-in-htaccess-to-avoid-resource-interpreted-as-image-but-transferre
and i think the apache forum is the more appropriate place for it.

In my single-page-webapp i used the html5 history API so that urls could have a REST pattern (/section1/stuff1..) and i'm planning to make a sort of a javascript router to navigate to several sections of the page depending on the url path.

Right now i'm still working on a local server(wamp) and i added a .htaccess file:

Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php/$1 [L]


to the app root for that url's paths containing references to some sections of the page (e.g subdomain/sectionN) can redirect always to the index.php and the redirection was successful BUT all external ressources failed to load and i got :

Resource interpreted as Image but transferred with MIME type text/html: "http://localhost/subdomain/section1/images/imgname.gif"
.
and it's logic because the images folder lies in the app root and not under a /section1 folder and the .htaccess rule RewriteRule (.*) index.php/$1 [L] should take only the /images/imgname.gif part and concatinate it after the http://localhost/subdomain/.

I found this as a similar problem so i rewrite the .htaccess file like this :

Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?section1/(.+)$ index.php/$1
RewriteRule (.*) index.php/$1 [L]
but i got a
500 Internal Server Error.
bart83
 
Posts: 1
Joined: 17. May 2015 17:37
Operating System: windows 7

Re: Write a rule in .htaccess to avoid “Resource interpreted

Postby Nobbie » 17. May 2015 19:25

Look into the error logfile and it will show you a more qualified message.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 91 guests