On Feb 27, 2013, at 6:13 AM, Simon Dorfman simon@yamlike.com wrote:
Hello,
I just installed a new wiki. I'm trying to get Short URLs working using .htaccess.
Once things are working properly, my URLs should look like this: http://wiki.domain.tld/Main_Page
I tried following the example here: https://www.mediawiki.org/wiki/Manual:Short_URL/Apache
...but the example assumes two things that are not true for me:
- you installed mediawiki into a folder called "w"
- you want you URLs to look like this:
http://wiki.domain.tld/wiki/Main_Page
I installed mediawiki into my "root" domain folder, not in a sub-folder I don't want "wiki" to appear before /Main_Page.
That's okay if they are not true. The manual simply uses those as example (there is no point in making an example for every possible combination and path depth). Though it may be too complicated, all the necessary information is on that page.
Table: "/index.php in the root, /Page_title, /.htaccess"
RewriteEngine On
"If you are using a root url instead of a normal short url you will need to use the following instead: .. "
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/w/index.php [L]
"include a rule to show the Main Page on the path itself"
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
By the way, please know that you can access the wiki from the root while still having the files on the hard drive in a sub directory. This way you keep the web server root clean when navigating the directories, and it minimises the number of "impossible pages" (pages that conflict with files in the root).
The code code above I assumed you put mediawiki in the /w directory, the RewriteRules will then make the root the access point for the page titles.
So example.org/Page_title will show [[Page title]], even though index.php is at example.org/w/index.php.
I'd highly recommend doing this if you want to have the urls from the root.
-- Krinkle