Welcome to WebmasterWorld Guest from 18.104.22.168
RewriteRule ^wiki/(.*)$ w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ wiki/ [L,QSA]
RewriteRule ^/*$ wiki/ [L,QSA]
Mediawiki is installed in a directory /w. The above works perfectly apart from the url www.mysite.com redirects users to the main page of the wiki. How do I correct this? Someone please help, I dont know much about URL rewriting. I basically want it to act like it does now, without this problem.
The third rule will never match anything, because URL-paths 'seen' by RewriteRule in .htaccess will never start with a slash. The correct pattern to match a request for example.com/ would simply be "^$".
Put your rules in order from most-specific to least-specific -- Special cases need to go first, or you must add exceptions to your 'early' rules by using RewriteConds.
Also, you don't need to specify [QSA] if the RewriteRule's substitution (new) URL or filepath does not contain a "?". The default behavior of mod_rewrite is to pass query strings through unchanged.
I just commented this line out:
##RewriteRule ^/*$ wiki/ [L,QSA]
All is working as it should now.
Being practical, you may not feel that you have time for this right now. But do come back to it -- and soon. Otherwise, you may have serious problems with server operation and ranking problems because there is some "hole" in your server configuration that allows these problems to happen. The Google forum is full of threads from Webmasters that did not build a proper foundation for their sites, and are now suffering the consequences.
The idea that using a pre-built forum, blog, or wiki means that you don't have to bother with "all that technical stuff" is a dangerous myth. In fact, some of these packages require you to deal with even more server-level issues because their authors ignored those issues and left their users open to major problems.
Two examples are lack of URL canonicalization leading to duplicate content and the resulting ranking problems, and the widely-known problem of security exploits in un-patched popular software.