Erudes Posted February 25, 2020 Share Posted February 25, 2020 Hey everyone, new to the forum hope I'm posting in the right place. I have MediaWiki installed on Apache on CentOS7. Everything works fine, but I need to rewrite URLs to make them shorter. Default path is http://mediawiki.my.domain/mediawiki/index.php/article, and I'm just trying to get them like this: http://mediawiki.my.domain/mediawiki/article I edited LocalSettings.php on MediaWiki path with: $wgScriptPath = "/mediawiki"; $wgArticlePath = "/mediawiki/$1"; And I also have and .htaccess file on /var/www/html with the following: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^mediawiki/(.*)$ mediawiki/index.php?title=$1 [PT,L,QSA] RewriteRule ^mediawiki/*$ mediawiki/index.php [L,QSA] RewriteRule ^mediawiki$ mediawiki/index.php [L,QSA] So when I type http://mediawiki.my.domain/mediawiki I get a 404 Not Found The requested URL /mediawiki/Main_Page was not found on this server. Any ideas on what I'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/310136-apache-rewrite-rules-htaccess-file/ Share on other sites More sharing options...
requinix Posted February 25, 2020 Share Posted February 25, 2020 Do you get a 404 from the server or a 404 from MediaWiki? Are you following these instructions? Quote Link to comment https://forums.phpfreaks.com/topic/310136-apache-rewrite-rules-htaccess-file/#findComment-1574913 Share on other sites More sharing options...
Erudes Posted February 25, 2020 Author Share Posted February 25, 2020 Well the error is: The requested URL /mediawiki/Main_Page was not found on this server. So I'll guess the server is the one who can't display it for some reason. Yeah, I'm following those instructions but can't seem to find what I'm missing... I replaced /w and /wiki with /mediawiki which is my mediawiki directory. Access Logs show this: 10.8.150.142 - - [24/Feb/2020:09:01:06 -0500] "GET /mediawiki/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [24/Feb/2020:09:01:07 -0500] "GET /mediawiki/Main_Page HTTP/1.1" 404 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [24/Feb/2020:09:01:07 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:47:49 -0500] "GET /mediawiki/%7D HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:47:49 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:47:53 -0500] "GET /mediawiki/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:47:55 -0500] "GET /mediawiki/Main_Page HTTP/1.1" 404 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:47:56 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:48:06 -0500] "GET / HTTP/1.1" 200 130 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:48:06 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:48:11 -0500] "GET /mediawiki/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:48:11 -0500] "GET /mediawiki/Main_Page HTTP/1.1" 404 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:08:48:11 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:09:07:37 -0500] "GET /mediawiki/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:09:07:38 -0500] "GET /mediawiki/Main_Page HTTP/1.1" 404 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" 10.8.150.142 - - [25/Feb/2020:09:07:38 -0500] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/310136-apache-rewrite-rules-htaccess-file/#findComment-1574915 Share on other sites More sharing options...
Erudes Posted February 25, 2020 Author Share Posted February 25, 2020 htaccess had to be on root folder not mediawiki. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/310136-apache-rewrite-rules-htaccess-file/#findComment-1574916 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.