Solved

Apache Symbolic Links

Posted on 2011-09-20
5
254 Views
Last Modified: 2012-05-12
Hello,

I am going to install magento on a Added domain and I need to add these symbolic links:

ln -s ../public_html/app ./app
ln -s ../public_html/errors ./errors
ln -s ../public_html/includes ./includes
ln -s ../public_html/js ./js
ln -s ../public_html/lib ./lib
ln -s ../public_html/media ./media
ln -s ../public_html/skin ./skin
ln -s ../public_html/var ./var

If adding these creates a problem with the current site I would like to know how to remove them quickly.

What would the shell command be to 'undo' these?

Thank you for your help,
Matt
0
Comment
Question by:movieprodw
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
sakman earned 500 total points
ID: 36568377
The symbolic linked directories can just be deleted without affecting the original directory.  The symbolic links are files, not directories, so you use "rm".

To be safe, you can verify the file is a link using the "-h" in a test statement.

You can remove all symbolic links in a directory using a short "for" loop.   To test it, I would use "echo" instead of "rm" first, then re-run it with "rm":

$ for file in `ls -1 ../public_html/`
> do
> if [ -h $file ]; then
>     echo "$file"
> fi
> done

Open in new window

0
 
LVL 4

Expert Comment

by:sakman
ID: 36568408
To clarify, you want to delete the links in the directory they reside.   My example above is misleading because I was listing the files in public_html.

You would want to whatever directory you have the links (app, errors, etc).

If there are only links there you could just remove them all.  Or if you want to loop over mixed files and links, you could run a for loop as above, but first CD into the directory with the links and then `ls -1`
0
 
LVL 1

Author Comment

by:movieprodw
ID: 36568430
Okay so I can use shell and enter:

cd folder_name/
ln -s ../public_html/app ./app
ln -s ../public_html/errors ./errors
ln -s ../public_html/includes ./includes
ln -s ../public_html/js ./js
ln -s ../public_html/lib ./lib
ln -s ../public_html/media ./media
ln -s ../public_html/skin ./skin
ln -s ../public_html/var ./var

to create and

cd folder_name/
rm -s ../public_html/app ./app
rm -s ../public_html/errors ./errors
rm -s ../public_html/includes ./includes
rm -s ../public_html/js ./js
rm -s ../public_html/lib ./lib
rm -s ../public_html/media ./media
rm -s ../public_html/skin ./skin
rm -s ../public_html/var ./var

to remove?
0
 
LVL 4

Expert Comment

by:sakman
ID: 36568456
Nope.

Just cd into the folder that has the links and remove them:
rm app errors include js ....

You can use ls -l to see that they are links.

The "for" loop in my example was only if you had a bunch of other files in that directory.
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 36989695
thanks
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Service "nameserver" appears to be down 4 586
PHP temp path missing 4 51
Apache 2.2 on Windows 2008 32 76
Stream live video from Raspberry Pi camera 22 153
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question