Jump to content

Made wiki URLs nicer


Recommended Posts

  • 2 weeks later...

Pretty urls are defined in the .htaccess file which probably has a line like this so far:

RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] 

However, it's easy to change to whatever you want, this for example:

RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] 
RewriteRule ^/?w(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] 

Will allow "w" and convert it to "wiki", but if I change it to this:

RewriteRule ^/?docs(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] 
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] 

It will just ignore one of them.

Now, your idea was to use the root right? Well that's a bad idea, it causes conflicts with real existing folders. You can read more about that here:

http://www.mediawiki.org/wiki/Manual:Short_URL

"wiki" is very common even on pages with subdomains so if anything really needs to be changed at all that "w" and "wiki" thing might work, except for that it's a worthless idea.

Link to comment
It would be easier if we just had the subdomain set up to point to /wiki/ folder honestly. Rewrite rules are overkill for this.

Default media wiki url's looks like this at the end: 'index.php?action=', so you are most likely already using Rewrite rules in some way, it's not overkill at all, in fact, most media wiki's use this. Why most people chose to name their virtual folder to 'wiki' is a mystery tho. :roll:

Link to comment
Now, your idea was to use the root right? Well that's a bad idea, it causes conflicts with real existing folders.

No. Keep wiki on /wiki/ folder and just redirect https://wiki.multitheftauto.com/Whateva to https://mtasa.com/wiki/Whateva

I'm using this on my site:

RewriteRule ^w/(.*)$ /wiki/$1 [L,NC] #redirect /w/ to /wiki/ 
  
RewriteCond %{REQUEST_FILENAME} !/wiki/ 
RewriteCond %{HTTP_HOST} wiki.multitheftauto.com 
RewriteCond %{REQUEST_URI} !wiki/ 
RewriteRule (.*) /wiki/$1 [L] 
  
RewriteCond %{REQUEST_FILENAME} !/wiki/ 
RewriteCond %{HTTP_HOST} wiki.multitheftauto.com 
RewriteCond %{REQUEST_URI} !wiki/ 
RewriteRule (.*) /wiki/$1 [L] 
  

Maybe it can be done better, but this one works. Also this need to be converted to nginx system I think :P.

Link to comment
  • 1 month later...
  • MTA Team

first off:

assumption is the mother of all f*ckups. We don't use apache and therefore we don't have a .htaccess

second:

the /wiki/ subdir is something that mediawiki does by default. Blame them, not us. And why does it even bother you? Typing in wiki.multitheftauto.com in your browser takes you to our wiki. After that it's all just bookmarks and/or copy/paste.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...