Topic on Manual talk:Short URL/Apache

Never applies the rules even when AllowOverride is on.

3
67.171.179.59 (talkcontribs)

Centos 7, Apache 2.4.6

So, I am trying to short URL like this:

http://mywiki.com/index.php/article

to

http://mywiki.com/wiki/article

[Edit: I changed this from mywiki.com/article to mywiki.com/wiki/article. Sorry, I originally wrote this after doing command line for about 8 hours straight.]

I have mod_rewrite enabled:

grep -i LoadModule /etc/httpd/conf/httpd.conf | grep rewrite

gives

LoadModule rewrite_module modules/mod_rewrite.so

I have a symbolic link called "fts" that points to the root folder of the wiki documents.

I go to my root folder of my wiki documents:

cd /var/www/html/mediawiki-1.24.1 
sudo vim .htaccess

and then I create this .htaccess file

## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
 
# Enable the rewrite engine
RewriteEngine On
 
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/fts/index.php [L]
 
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/fts/index.php [L]

Then I load up my wiki and nothing is different. So, I go back to to httpd.conf and make sure AllowOverrides All is on:

grep -i AllowOverride /etc/httpd/conf/httpd.conf

gives

AllowOverride None
AllowOverride All <--- this is the <Directory "/var/www/html"> section one
AllowOverride None
AllowOverride None

What's up here? I can't figure out why nothing is going on. I'm restarting httpd every time I do an edit to anything.

Ciencia Al Poder (talkcontribs)

Note that only adding stuff to apache config files doesn't automagically make MediaWiki aware of the new URL scheme. You should change $wgArticlePath accordingly so MediaWiki generates URLs following that scheme.

You said you want your URLS to be http://mywiki.com/article, but you set up rules for URLs like http://mywiki.com/wiki/article:

RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/fts/index.php [L]

Also note that the URL scheme you propose is not recommended, since there are more paths under your mywiki.com domain that shouldn't be treated as wiki pages. Looks like you're missing reading/understanding some important parts of the manual.

And I don't understand why do you have a fts link pointing to the parent folder. That's really awkward.