Domanda

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?

È stato utile?

Soluzione

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]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top