Hi Cindy, I have an issue setting up ShortUrl using $wgArticlePath
. Following the documentation I was able to create the short url but I get 404 error. Please let me know if there is a fix for this.
Below are my configurations:
My Folder name and Url is set to "mediawikinew"
In my LocalSettings.php File I have set
$wgScriptPath = "/mediawikinew";
$wgArticlePath = "/mediawikinew/$1";
$wgUsePathInfo = true;
My Nginx for mediawiki conf is set to this
server{
listen 80;
listen [::]:80;
server_name mediwikinew;
root /var/www/mediawikinew;
index index.php;
error_log /var/log/nginx/mediawikinew.error;
access_log /var/log/nginx/mediawikinew.access;
location / {
try_files $uri $uri/ /index.php;
#try_files $uri $uri/ @mediawikinew;
}
location ~ /.well-known {
allow all;
}
location ~ /\.ht {
deny all;
}
location /mediawikinew/ {
#rewrite ^/mediawikinew/(?<pagename>.*)$ /mediawikinew/index.php;
rewrite ^/mediawikinew/([^\?]*) /mediawikinew/index.php?title=$1&$args last;
}
location = / {
return 301 /mediawikinew/Main_Page;
}
location ~ ^/mediawikinew/(index|load|api|thumb|opensearch_desc|rest|img_auth)\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
include snippets/fastcgi-php.conf;
}
location /mediawikinew/images/deleted {
# Deny access to deleted images folder
deny all;
}
location /mediawikinew/images {
# Separate location for images/ so .php execution won't apply
}
location ~ ^/mediawikinew/resources/(assets|lib|src) {
try_files $uri =404;
add_header Cache-Control "public";
expires 7d;
}
location ~ ^/mediawikinew/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$ {
try_files $uri =404;
add_header Cache-Control "public";
expires 7d;
}
location = /favicon.ico {
alias /mediawikinew/images/6/64/Favicon.ico;
add_header Cache-Control "public";
expires 7d;
}
location ~ ^/mediawikinew/(COPYING|CREDITS)$ {
default_type text/plain;
}
location /mediawikinew/rest.php/ {
try_files $uri $uri/ /mediawikinew/rest.php?$query_string;
}
}