Topic on Manual talk:Short URL/Apache

Using Alias instead of RewriteEngine

5
Jcrummy (talkcontribs)

I was unable to get this working using RewriteEngine, however using Alias did. I added:

 Alias /wiki "/var/www/html/w/index.php/"

And everything works great. I did this in httpd.conf, which won't work if you don't have access to it.

Is there any reason why this wouldn't be a good idea?

-John

Dantman (talkcontribs)

Alias basically turns /wiki/Foo into /w/index.php/Foo rather than just telling Apache to load index.php. I can't remember the specific things that ended up different but it isn't ideal.

In what way did it break when you tried configuring it with RewriteEngine? Was it a 404 or a 500 error? If it was a 500 error, what showed up in the error log?

Berot3 (talkcontribs)

If you google ''alias vs rewrite" you will find that apache recommends alias over rewrite. Mediawiki is special, butb I did not read of any problems with alias. Do you?

Also what do you mean by "just telling Apache to load index.php", to me it looks like alias and rewrite are both replacing one with the other, dont they?

Berot3 (talkcontribs)

So after some more testing I think it's worth mentioning in the Manual, that there is an alternative to rewrite with alias. In the Manual it only says that you can try using Alias if rewrite is not working in some cases. But I think this should be it's own part:

Note: this has to be done by altering the httpd.conf.

Simple instructions: httpd.conf source code:

Alias /w        ../apps/mediawiki/htdocs
Alias /wiki     ../apps/mediawiki/htdocs/index.php

LocalSettings.php source code

$wgScriptPath  = "/w";
$wgArticlePath = "/wiki/$1";

Can anyone confirm that this works?

Does anyone think that this has any downsides? (besides root-permissions for editing httpd.conf)

Berot3 (talkcontribs)

I think I forgot to mention something important. the apache-config is probably different when using virtual hosts. the code above is just for using with prefix and without vhost.

Reply to "Using Alias instead of RewriteEngine"