Topic on Manual talk:Short URL/Apache

Summary by Berot3

always use the recommended way

Domitori (talkcontribs)

In the description of the changes in httpd.conf, the following sequence of characters appear:

DOCUMENT_ROOT

Is it somehow related with variable $wg used in the LocalSetting.php? Should this sequence of characters be replaced to something specific for my computer or it should be copypasted as is?

As I understand, in order to provide the Short URL, the following lines should be added to httpd.conf

## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
# Enable the rewrite engine
RewriteEngine On

# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]

Should I add these lines at the end of file httpd.conf ? Domitori (talk) 12:40, 12 April 2013 (UTC)

P.S.: 'DOCUMENT_ROOT' is The document root directory under which the current script is executing, as defined in the server's configuration file.

Dantman (talkcontribs)

%{DOCUMENT_ROOT} is an Apache variable that automatically contains whatever the DocumentRoot is set to, leave it alone. It's not related to any of the LocalSettings.php config variables.

Where you put it will depend on whether you have root access and where the DocumentRoot, etc... for MediaWiki has been configured.

Domitori (talkcontribs)

Thanks, Daniel, for the quick answer. Perhaps, in my case, %{DOCUMENT_ROOT} has value /library/Server/Web/Data/Sites/Default ; however, I cannot find the file, where this value is assigned.

Another problem: I found many directories called "apache2" at various places, and there are many files called httpd.conf there . It is difficult to guess: which of them should be edited?

Dantman (talkcontribs)

%{DOCUMENT_ROOT} isn't assigned in any file. It's natively handled by Apache itself. You won't see where it's handled unless you go looking at Apache's pre-compiled C source code.

I can't really help you figure out what file you should use, different operating system distributions put it in different locations. You should probably ask whoever setup the server for you or perhaps just use .htaccess files instead.

Domitori (talkcontribs)

Thank you Daniel. The configuration of .htaccess does not look simpler, so, I still try to follow the suggestion The recommended way to setup short URLs in Apache is by editing the Apache config files. I think, I should edit httpd.conf ; it is first file mentioned in the instruction, that I find in my server. Perhaps, I am not at the shared host, and, perhaps, I do not use a virtual host. (I am investigating the case.) Also, I do not know, whether the restarting Apache is somehow related to the restarting of server or not. I think, first, I should learn to restart the Apache. (Over-vice, if a crash, I shall not now, is it due to the error at the editing of httpd.conf or due to some error at the restarting procedure.)