• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

stock htaccess question about friendly URL's

mrGTB

Well-known member
#1
I'm just curious about something to do with the stock HTACCESS file that comes with XenForo. Usually when you add fiendly URL rewrite code, most sites like askapache will tell you to add this line.

Code:
Options +FollowSymlinks
Is there any particular reason why XenForo doesn't use it by default?
 

DRE

Well-known member
#2
Good question. Adding that to my htaccess

Code:
Options +FollowSymLinks
RewriteEngine on
Read about it here: http://corz.org/serv/tricks/htaccess2.php

and here too: http://gallery.menalto.com/node/32607

pelle said:
Options +FollowSymlinks is used for hiding the real location of your files. For example, if you have a picture located in
/whatever/myfolder/secret/image.jpg
you can display it at the website as
img src="/images/image.jpg"
. You need Options +FollowSymlinks for this to work.
If you use mod_rewrite, you must have Options +FollowSymlinks enabled too.
And performancewise, Options +FollowSymlinks improves the performance a little, but it is really negligible.
Here is a nice explanation how FollowSymlinks works: http://www.maxi-pedia.com/FollowSymLinks'
I also read this: http://www.maxi-pedia.com/FollowSymLinks

What is FollowSymLinks?

We already mentioned that FollowSymLinks tells the web server to follow symbolic links while looking for a file, but what does it really mean?

Symbolic links (also called symlinks or softlinks) most resemble Windows shortcuts. Websites are often set up in a way that they show pictures and other content as being physically located at some other location than they really are. Let's say you browse to some website and look at the web page source. You might see something like IMG SRC="/system/files/images/image.png" for the location of some picture that interests you. If you browse to this location in your Internet browser, it will show you the picture. But if you log into the server and go to that location /system/files/images/, you will not find it. The image.png file is not physically located in a /system/files/images/ folder, but let's say it is in a folder called /pictures.

How does the server know that it should pull image.png from the /pictures folder when you visit the website and browse to the /system/files/images folder in your web browser? A so-called symbolic link is the guy that is responsible for this behavior. Somewhere in your system, there is a symlink that tells your server "If a visitor requests /system/files/images/image.png then show him /pictures/image.png."

And what is the role of the FollowSymLinks setting in this?
FollowSymLinks relates to server security. When dealing with web servers, you can't just leave things undefined. You have to tell who has access to what. The FollowSymLinks setting tells your server whether it should or should not follow symlinks. In other words, if FollowSymLinks was disabled in our case, browsing to the /system/files/images/image.png file would return depending on other settings either the 403 (access forbidden) or 404 (not found) error.
 

mrGTB

Well-known member
#4
This is not required in any way. It will make not one bit of difference in xenforo's case.
Can you explain exactly why you said that? As just saying it won't make no difference tells nothing, what makes you say that? I'm aware in most web server cases it's not needed, but is used anyway as a safe guard measure just in case it is needed.
 

Rob

Well-known member
#6
Unless you have yourself created symbolic links then you will not need the setting since xenforo (or any mods I know of) create them.

To be totally honest, most systems with mod rewrite enabled have this options enabled by default anyway as it required by mod rewrite on most setups as far as i know.