Forum Moderators: phranque

Message Too Old, No Replies

alias or mod_rewrite on localhost?

         

tropicallea1

7:10 am on Jun 22, 2006 (gmt 0)

10+ Year Member



I installed apache on local machine. Everything works fine, except that mySQL is trying tu pull pictures (for example) from:
/home/tropical/public_html/files/productimages/stingray.jpg
so it pulls nothing because on localhost these pictures are in root directory /files/productimages/stingray.jpg

can I use any alias or mod_rewrite in .htaccess so it would find the pictures?
what it should look like?

thanks for any help.

coopster

1:07 pm on Jun 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, tropicallea1.

Can I make a suggestion? When you write the images directory to your database table, don't write the entire path out there but start at the end of your document root. Then, in your application program, concatenate the directory structure back together again. So, you would store

files/productimages/stingray.jpg
in the database table column. Then use your server-side scripting language to append the DOCUMENT_ROOT to the directory structure. Now it will be much more portable, meaning it will work not only on your development platform, but also any other site you want to move the code to, including your current LIVE site. Make sense?

tropicallea1

3:53 am on Jun 23, 2006 (gmt 0)

10+ Year Member



Thanks Coopster,

the problem is that I use x-cart shopping cart and they write the path to all images into mySQL database. (i upload the images through the web interface). I don't have any control over it.

Now, when I download the database to the local machine, the system can not (for ex.) find image in:
[localhost...]
because the image is in:
[localhost...]
how can I alter the behaviour of the system, so the system can find images when is given full path?
is there anything that I can write into the .htaccess or httpd.conf files on local system?
Unfortunately I don't know much about these things.

tropicallea1

3:56 am on Jun 23, 2006 (gmt 0)

10+ Year Member



of course I can create the folder with the long path and move there all images, but this would devoid me of sinchronization feature between local and remote machine.

coopster

2:24 pm on Jun 23, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about just creating a symbolic link on your test box instead?

tropicallea1

10:56 am on Jul 13, 2006 (gmt 0)

10+ Year Member



sorry for long no answer,

I'm running the shop (almost) alone and I had all other software issues, but I haven't solved this one.

what is a symbolic link?
we are talking about 150images

thanks,
Dominik