MediaWiki like directory system
So if you look at a mediawiki url:
http://en.wikipedia.org/wiki/Stack_Overflow
You see that the page is a subdirectory of index.php in /wiki. How can I make my script work like
http://mysite.com/users/Walter
when all I have in the users directory is index.php (and other resources to make index.php work?开发者_开发知识库)
You will need to do some URL rewrite on your web server, for examples on nginx:
server {
listen 80;
server_name wiki.example.com;
root /var/www/mediawiki;
location / {
index index.php5;
error_page 404 = @mediawiki;
}
location @mediawiki {
rewrite ^/wiki([^?]*)(?:\?(.*))? /index.php5?title=$1&$2 last;
}
location ~ \.php5?$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php5;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
There's a very good guide over here: https://www.mediawiki.org/wiki/Manual:Short_URL
精彩评论