Is there a way in PHP to check if a directory is a symlink?
Posted
by tixrus
on Stack Overflow
See other posts from Stack Overflow
or by tixrus
Published on 2010-05-28T21:13:52Z
Indexed on
2010/05/28
21:22 UTC
Read the original article
Hit count: 317
The title says it all. I have symlinks to certain directories because the directories' names have non English characters that I got fed up trying to get apache's rewrite rules to match. There's a bounty on that question http://stackoverflow.com/questions/2916194/trouble-with-utf-8-chars-apache2-rewrite-rulesif anyone wants to go for it, and from the looks of things a lot of people would like to see a general solution to this problem, but meanwhile I made a plain ascii symlink to each of these offending directories. Now the rewrite rules are back to just alpha and _ and - and my security concerns are less and it loads the resources I want. But I still need the actual target directory name for display purposes. I googled "PHP directory info, PHP symlink" but didn't find anything. I need to do something like this:
if (is_symlink($myResDirName)) {
$realDirName = follow_symlink($myResDirName);
}
© Stack Overflow or respective owner