Manual talk:Short URL/wiki.example.com/Page title--Subdomain using mod-rewrite

From MediaWiki.org
Jump to: navigation, search

[edit] Robots.txt and favicon.txt

To make sure that robots.txt and favicon.ico are found in the root directory, I modified that .htaccess text:

RewriteCond %{REQUEST_URI} !^/w.*/
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteRule ^(.*) /wiki/index.php/$1 [L]

--84.9.191.165 15:01, 8 November 2008 (UTC)

  • I find that a more general version is useful:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond wiki/%{REQUEST_FILENAME} -f
RewriteRule ^. /wiki/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /*(.+) /wiki/index.php?title=$1 [L,QSA]
  -- 109.155.130.205 12:05, 11 May 2011 (UTC)

[edit] This seems a bit confusing

Hello. This section seems to insinuate both that the directory you've installed mediawiki is wiki.example.com/w and wiki.example.com/wiki, or that you want to rewrite from wiki.example.com/wiki/ to wiki.example.com/w/:

   RewriteEngine On
   RewriteCond %{REQUEST_URI} !^/w.*/
   RewriteRule ^(.*) /wiki/index.php/$1 [L]

See? First line says w.*, and since I'm not familiar with mediawiki that looks ok, but then the next line says rewriterule wiki/index.php/$, but i installed to /w/ like on WikiPedia. Some other documents in the manual suggest installing to /w/ so you can use /wiki/Pretty_title. I'd like, if possible, for the page to have information on what the code does. --IBulk 18:35, 18 November 2008 (UTC)

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox