I am trying to configure a wikimedia installation. The wiki is installed in a subfolder of my server (www.mydomain.com/wiki) and is serverwise redirected to wiki.mydomain.com which was working fine.

I was able to use wiki.mydomain.com/index.php?title=Main_Page to access the site. But then I tried to use even shorter URLS like: wiki.mydomain.com/Main_Page.

So I created a .htaccess file in the wiki subfolder (which is accesed by wiki.mydomain.com) with the following content:

RewriteBase /
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule ^(.*) /index.php?title=$1 [L,QSA]

Which also works for the sites!

But: The css sheets seem to be missing. - The sites look really ugly. How can I assure that only the page requests are redirected but not the file requests to the needed files?

有帮助吗?

解决方案

Check if requested filename is an existing file. If so, don't rewrite. Otherwise, forward it to index

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top