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: 1. you installed mediawiki into a folder called "w" 2. 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.
Can someone please paste an example htaccess file that will work with these two requirements?
Thanks very much in advance! -Simon
RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L] RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
On Wednesday, 27 February, 2013 01:13 PM, Simon Dorfman 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.
Can someone please paste an example htaccess file that will work with these two requirements?
Thanks very much in advance! -Simon _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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
mediawiki-l@lists.wikimedia.org