Saturday 15 September 2012

html - Rewrite Rule htacces searches for css in wrong folder -



html - Rewrite Rule htacces searches for css in wrong folder -

when add together htaccess rewrite rules, paths scr attributes intern use, beingness shifted. first rule css works fine when adds sec variable in link css files , script files called out of wrong folder.

options +followsymlinks rewriteengine on rewritebase /jellyfish_rework/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]*)$ index.php?p=$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]*)/([^/]*)$ index.php?p=$1&t=$2 [l]

in first rule, works perfect. illustration when link 1 variable (the p variable page) works should be. link in case ends beingness http://localhost/jellyfish_rework/blog. , css , scripts beingness called

<link href="css/jellyfish.css" rel="stylesheet" type="text/css"> link css style sheet.

however, when t (stands title) variable filled in, when illustration trying find specific post in blog, whole links change. chrome console output on http://localhost/jellyfish_rework/artikel/lancering-van-onze-nieuwe-website following:

get http://localhost/jellyfish_rework/artikel/css/font-awesome.min.css lancering-van-onze-nieuwe-website:23 http://localhost/jellyfish_rework/artikel/css/jellyfish.css lancering-van-onze-nieuwe-website:24 http://localhost/jellyfish_rework/artikel/css/bootstrap.min.css lancering-van-onze-nieuwe-website:22 http://localhost/jellyfish_rework/artikel/css/animate.css lancering-van-onze-nieuwe-website:25 http://localhost/jellyfish_rework/artikel/js/custom/knob.js lancering-van-onze-nieuwe-website:168 http://localhost/jellyfish_rework/artikel/js/bootstrap/bootstrap.min.js lancering-van-onze-nieuwe-website:166 http://localhost/jellyfish_rework/artikel/js/custom/wow.min.js lancering-van-onze-nieuwe-website:167 http://localhost/jellyfish_rework/artikel/js/custom/jellyfish.js lancering-van-onze-nieuwe-website:169

why adding /article/ relative path of scripts , css? , how can prepare this?

you running problem due utilize of relative urls in css/js/images. can prepare 1 of ways:

use absolute path in css, js, images files rather relative one. means have create sure path of these files start either http:// or slash /.

otherwise seek adding in page's html header: <base href="/" /> every relative url resolved url , not current url.

html css .htaccess

No comments:

Post a Comment