开发者

MediaWiki like directory system

开发者 https://www.devze.com 2023-04-07 01:37 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消