php - Mod_rewrite, trying to exclude images and css files -


i trying find way exclude image files , css files mod_rewrite permissions

options +followsymlinks rewriteengine on  #secfilterinheritance off errordocument 404 /fourohfour.php  rewritecond %{http_host} ^(myurl\.com)$ [nc] rewriterule ^(.*)$ http://www.%1/$1 [r=301,l] rewritecond %{request_uri} !\.(?:css|png|jpe?g|gif)$ [nc,or]  #my attempt @ excluding  rewriterule ^articles/([^/]+)/([^/]+)/?$ /article.php?id=$1&articletopic=$2 [qsa,l] 

problem exclusion line isn't quite accurate , need it

if go phpscript in directory isn't included in .htaccess rewrite.. isntance www.myurl.com/articlelinks.php redirected this:

http://www./articlelinks.php   

to complicate things further:

if go to: http://www.myurl.com/articles/1/dorsal+and+volar+intercalated+segment+instability+(disi+and+visi) css files don't load

if go to:

http://www.myurl.com/articles.php?id=1&articletopic=dorsal+and+volar+intercalated+segment+instability+(disi+and+visi) proper document loaded css , images

please help?

you have or flag in condition, there no other condition after it, , makes mod_rewrite think: %{request_uri} !\.(?:css|png|jpe?g|gif)$ or (anything). try removing or

rewritecond %{request_uri} !\.(?:css|png|jpe?g|gif)$ [nc] rewriterule ^articles/([^/]+)/([^/]+)/?$ /article.php?id=$1&articletopic=$2 [qsa,l] 

the reason css isn't loading because you're using relative url paths in document. try either changing links absolute url paths (starts /) or add page's header:

<base href="/" /> 

the blank host problem, not sure why that's happening. try adding condition:

rewritecond %{http_host} !^$ 

so rule looks like:

rewritecond %{http_host} !^$ rewritecond %{http_host} ^(myurl\.com)$ [nc] rewriterule ^(.*)$ http://www.%1/$1 [r=301,l] 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -