Can't load css, js and images when using .htaccess -


i have "mysite.com" , want when loads load contents "mysite.com/new-site" folder. .htaccess looks this:

rewriteengine on  rewritecond %{http_host} ^www\.mysite\.com$ rewriterule ^/?$ "http\:\/\/mysite\.com\/" [r=301,l]  rewriterule ^(/)?$ new-site/ [l] 

and loads html withoute css, js or images. how can tell htaccess load them new-site directory ?

you use

rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(?:[^/]*/)*([^/.]+\.(?:jpe?g|gif|bmp|png|tiff|css|js|images))$ /new-site/$1 [r=301,l,nc] 

edit:

here's bit more code little explanation can notice on server.

rewriteengine on rewritecond %{the_request} "index.php" rewriterule ^index.php$ public/ [r=301,l] rewriterule . public/index.php [qsa,l] rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(?:[^/]*/)*([^/.]+\.(?:jpe?g|gif|bmp|png|tiff|css|js))$ /public/assets/$1 [r=301,l,nc] 

so @ first says search index.php ( in case index.html or else site starts @ first), after says redirect folder public/ on server, since idex.php located in /www/public or /public_html/public, in case /www/new-site/ you'd new-site/ in part of code, next add same . new-site/index.php or whatever in case. on last part says search files end jpg/jpeg, gif, bmp, png, tiff, css or js in /public/assets/, in case new-site/assets/ or new-site/.

hope clarify's bit.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -