1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Apache ReWrite Rules .HTACCESS FILE

Discussion in 'Apache' started by Erudes, Feb 25, 2020.

  1. #2
    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 mediawiki.my.domain/mediawiki/index.php/article, and I'm just trying to get them like this: mediawiki.my.domain/mediawiki/article

    I edited LocalSettings.php on MediaWiki path with:
    
    $wgScriptPath = "/mediawiki";
    $wgArticlePath = "/mediawiki/$1";
    
    Code (markup):
    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]
    [code]
    
    So when I type [B]mediawiki.my.domain/mediawiki[/B] 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?
    Code (markup):

     
    Last edited: Feb 25, 2020
    Erudes, Feb 25, 2020 IP