Remove index.php

I have followed all of these instructions:

 4) How can I remove "index.php" from the URLs in OJS?

A: OJS uses a REST-style URL syntax for all of its links.  To force OJS to remove the
 "index.php" portion of all URLs, edit config.inc.php and set "restful_urls" to "On".
 
 In addition, your server will have to support URL rewriting in order to recognize
 the new URLs.  Apache servers use the mod_rewrite plugin, which must be enabled
 in your httpd.conf, and the following section added to the correct section of either
 your httpd.conf or an .htaccess file (preferred) in your OJS root directory (the same
 location as config.inc.php):
 
 <IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

and cant get it to change my url from:
[subdomain.site.com]/index.php/[journal]

to:
[subdomain.site.com]/[journal]

I am on a LAMP server on AWS,
running apache2,
mod_rewrite plugin is on,
in my apache2.conf file I have turned on the AllowOverride, see below:

Options FollowSymLinks
AllowOverride All
Require all denied

<Directory /usr/share>
AllowOverride All
Require all granted

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Does anyone know what else I may have to do?

Hi @kyrrah,

Have you taken a look at this post, there are a couple of suggestions that were provided by community members How to remove index.php in ojs 3.0.2.0 - #12 by ajnyga.

Kind Regards,
Patricia M.
Public Knowledge Project Intern

Hi @pmangahis,
I have taken a look at it and followed the suggestions there and still cannot remove the index.php from the url.

here is what I have done:

  1. My htaccess:

    RewriteEngine On
    RewriteBase /
    
    # Remove index.php
     RewriteCond %{SERVER_NAME} ^ourdomain.com
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php/$1 [L]
    
     # Handle subdomains
     RewriteCond %{SERVER_NAME} ^([a-z0-9-]+)\.ourdomain\.com$ [NC]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php/%1/$1 [L]
    
  2. The relevant settings in my config.inc.php:

    ; The canonical URL to the OJS installation (excluding the trailing slash)
    base_url = "http://journal.ourdomain.com"
    
    ; Base URL override settings:
    base_url[journal] = http://journal.ourdomain.com
    
    disable_path_info = Off
    
    ; Base URL override settings:
    base_url[journal] = http://journal.ourdomain.com
    
    ; Generate RESTful URLs using mod_rewrite.
    restful_urls = On
    

The problem is that not only does this not remove the index.php it also removes all the css like what was happening in the initial comment of the thread:
How to remove index.php in ojs 3.0.2.0

do you have any suggestions on what I may be doing wrong?

Hi @kyrrah,

I can’t help debug mod_rewrite rules in detail, as those are more an Apache question than an OJS question, but if you’re not seeing the stylesheets come up properly then it’s probably related to the rules:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

These instruct mod_rewrite not to rewrite the URL if a directory (!-d) or a file (!-f) exist in the filesystem that match the URL before the rewrite rule is applied. If so, then it skips the rewrite. This should be the case for serving up the CSS files. I would suggest inspecting the OJS site to see what URLs are supplied for the missing CSS files, and if those URLs look sensible, try requesting them manually. Work with the rewrite rules to ensure that they’re available to the browser.

Regards,
Alec Smecher
Public Knowledge Project Team