Note that there are some explanatory texts on larger screens.

plurals
  1. POhtaccess mod_rewrite css/js/images access issue
    primarykey
    data
    text
    <p>I am using apache mod_rewrite, htaccess.</p> <p>I find a way to achieve images/css/js file access without writing full url path in html/pages, from some site,(i forgot the site).</p> <p>So, I write in htaccess:</p> <pre><code>RewriteRule images/(.+)?$ images/$1 [NC,L] # it take images from images folder RewriteRule js/(.+)?$ js/$1 [NC,L] # it take js files from js folder RewriteRule topnav/(.+)?$ topnav/$1 [NC,L] # it take js/css from topnav folder RewriteRule common-style.css common-style.css # it take css from root folder RewriteRule jquery.js jquery.js # it take jquery from root folder </code></pre> <p>so, all js,css access.</p> <p>but now i added another rule</p> <pre><code>RewriteRule script/js/(.+)?$ script/$1 [NC,L] # it should take js from script/js </code></pre> <p>it doesnot work.</p> <p>i understand that now directory structure is two level i.e. script/js/ so it could not resolve file in "js" folder. but not know how to handle this.</p> <p>I tried a lot, using different pattern, but faild.</p> <p>Once again, My question is to access :</p> <pre><code>1) script/js/anyfile.js 2) script/css/anycssfile.css 3) script/blue_theme/Anyimagesfile.jpg 4) script/css/jquery/images/anyimages.jpg </code></pre> <p>Directory structure is as follow:</p> <pre> -script -js -css -jquery -images -blue_theme </pre> <p>Also, the path to fetch these resources is evaluated as by .httaccess:</p> <p><a href="http://localhost/site/Place-an-ad/Cars/Mazda/mazda-y/mazda-y-2/script/js/anyjsfile.js" rel="nofollow noreferrer">http://localhost/site/Place-an-ad/Cars/Mazda/mazda-y/mazda-y-2/script/js/anyjsfile.js</a></p> <p>but it is actualy at. <a href="http://localhost/site/script/js/anyjsfile.js" rel="nofollow noreferrer">http://localhost/site/script/js/anyjsfile.js</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload