I'm attempting to deploy a php / codeigniter project to some hosting that is shared atmosphere. In your area I'm running MAMP and all sorts of my pathways are recommended thus:-
background:transparent url(/img/myimj.jpg) left top no-repeat;
After I deploy the shared host, these links fail to work and also to resolve them I have to add "../". Altering each one of these references alone could be tedious. but codeigniter pathways will also be affected and I wish to know how I'm able to have a similar mapping as my local demonstration of MAMP apache.
Not well experienced in apache, I don't understand how to resolve this problem. I'm while using root public_html folder that's been planned to my user. Can you really make use of a rewrite rule inside a .htaccess to get this done?
You could utilize b .htaccess rewrite rule that simply directs all images/css/whatever to some specific directory.
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /path/relative/to/web-root/ RewriteRule /?([^/]+)\.css css/$1.css RewriteRule /?([^/]+)\.(jpe?g|png|gif) images/$1.$2 </IfModule>
This really is presuming all of your images have been in a folder known as
images and all sorts of the design and style-sheets inside a folder known as
Within this scenario, it might be best call the pictures and stylesheets inside your code/css utilizing an absolute path. This way images could be cached correctly. Even tho the server redirects all of the images towards the same directory, the customer wouldn't observe that. Therefore if exactly the same image was known as utilizing a relative path from two files in various positions from the tree, the customer would see individuals as two different images and never cache it correctly
In case your "shared" atmosphere implies that you are discussing a DOCUMENT_ROOT, then you will need to be cautious having a .htaccess file - as this is the .htaccess apply for everybody. Otherwise for those who have an online host, then an amount it decide to try upload you images into /path/to/document/root/img?
Interesting input about this.
Getting got right through to the website hosting company, I've since recognized the behavior of the virtual host differs if you don't come with an ANAME pointing into it. On adding one the folder public_html is planned as web root as it ought to be.