Page 1 of 1

how to redirect to another drive

PostPosted: 06. February 2011 14:10
by ravish4ualways
Hey guys,

Am using XAMPP to host my website.....its in a folder in drive C:/ ...... my webpages are in c:/xampp/htdocs.
Now i want to redirect a link in the webpage on c:/xampp/htdocs to a folder in another drive (say D:/media) ....how do i go about it??


Regards,
Ravs

Re: how to redirect to another drive

PostPosted: 06. February 2011 14:36
by WilliL
you could create a vhost pointing to "d:\media", that would be similar to an external link but managed on the same server
like "http://vhost_mymedia/file.ext"
I'm not sure thats an good idea if you are not having very good reasons..

read caefully: http://httpd.apache.org/docs/2.0/en/vhosts/ and sublinks

Re: how to redirect to another drive

PostPosted: 06. February 2011 14:39
by ravish4ualways
can u plz explain me how to go bout it....am a noob :(

Re: how to redirect to another drive

PostPosted: 06. February 2011 15:17
by WilliL
first I thought, you are just looking for an idea, but sorry now I've got a bad feeling..
Am using XAMPP to host my website.....its in a folder in drive C:/ ...... my webpages are in c:/xampp/htdocs.

did you secured xampp??
Xampp is not designed for real life in web, it could be overtaken very quickly an than a new bot is born :shock:

if you've got specified questions its ok, but basics you have to read fist.

forumsearch:
[url]http://community.apachefriends.org/f/search.php?keywords=vhosts&terms=all&author=&fid[]=16&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Suche[/url]

google search: http://www.google.de/search?as_q=&as_epq=vhosts&as_oq=&as_eq=&hl=de&num=10&lr=lang_en&cr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&as_rights=&safe=images&btnG=Google-Suche

BTW you could also copy needed files from "d:/media" to htdoc

Re: how to redirect to another drive

PostPosted: 07. February 2011 01:41
by Sharley
ravish4ualways wrote:Am using XAMPP to host my website
Always best to include the version you have installed

ravish4ualways wrote:Now i want to redirect a link in the webpage on c:/xampp/htdocs to a folder in another drive (say D:/media) ....how do i go about it??
You can use an Alias to do this but use a vhost if you have multiple web sites to host on the one server.

You can add your Alias in the C:\xampp\apache\conf\extra\httpd-xampp.conf file - for example add your Alias after the webalizer Alias and before the last </IfModule> like so
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp/webalizer">
<IfModule php5_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
</Directory>

Alias /media "D:/media/"
<Directory "D:/media">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>


</IfModule>
Change the folder to suit your situation as I have only used the detail you provided in your post.

Save the file and restart Apache.

Check the C:\xampp\apache\logs\error.log file for clues if Apache can't start after your edits.

Make sure that the text editor you use (notepad for example) does not save the file with a .txt extension automagically or you will get an error when starting Apache.

Read the C:\xampp\readme_en.txt file for help with security issues.

Make sure that WebDAV folder is deactivated - Advanced forum search in English Xampp for Windows will provide much detail about how to do this if you have not done so already and your version is pre 1.7.4 release.

Best wishes.

Re: how to redirect to another drive

PostPosted: 07. February 2011 04:43
by ravish4ualways
Thanx Ms Sharley.....:)
lemme try it and get bck to u thn :D

Re: how to redirect to another drive

PostPosted: 07. February 2011 04:58
by ravish4ualways
i follewed all ur steps Sharley and apache is running fine nw....but what link should i provide on webpage to point to D:/media folder

Re: how to redirect to another drive

PostPosted: 07. February 2011 08:37
by Sharley
What address do you use to access the rest of your web site?

Just add /media to that full address followed by a file name in your link, for example:
http://localhost/media/index.html
http://xxx.xxx.xxx.xxx/media/index.php
http://mydomain.com/media/filename.html
Code: Select all
<a href="http://localhost/media/index.html">Click me</a>
or
<a href="http://xxx.xxx.xxx.xxx/media/index.html">Click me</a>
or
<a href="http://mydomain.com/media/index.html">Click me</a>
Will serve the index.html file in the D:/media folder when you click on 'Click me' - get the idea?

When Apache receives the request for /media/filename.php it will serve the filename.php that you have included in the folder D:\media.