How-to use mod_rewrite to get rid of index.php in the url

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 1
Joined: Sat May 05, 2007 1:32 am

Postby aronchi » Sat May 05, 2007 1:37 am

I have one journal and I want to make it on the first page, with
I want to make administrative and other things available with /admin or another sub url.

Is it possible?

Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Postby asmecher » Sat May 05, 2007 10:55 am

Hi Alessandro,

Rearranging OJS's URLs could get quite complicated. The above discussion removes the usual index.php from OJS's regular URLs, but beyond that you'll need to get your hands dirty.

If it's important enough to warrant implementation and you have some PHP and mod_rewrite experience on hand, I can broadly describe the changes you'll need to make.

Alec Smecher
Open Journal Systems Team
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada

Posts: 51
Joined: Sat Apr 28, 2007 9:01 pm

Postby ozp » Wed May 16, 2007 7:58 pm

here is a .htaccess that did the job for me

Code: Select all

#pkp rewrites
DirectoryIndex index.html  index.php
RewriteBase   /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule  ^(.*)$ /index.php/$1
#pkp admin fix
RewriteRule inicio/admin/(.*) /index.php/index/admin/$1

the admin fix was because in PT_BR locale there is some king of problem with index and inicio (inicio means index)

Posts: 44
Joined: Mon Oct 29, 2007 6:04 am

Re: How-to use mod_rewrite to get rid of index.php in the url

Postby istoyanov » Fri Jan 04, 2008 9:12 am

I suppose that my case isn't that complicated, but I can't get the mentioned mod_rewrite rules to work.

I would like to get the following:

Code: Select all

http://MYDOMAIN/ojs/index.php/NEWJOURNAL -- > http://MYDOMAIN/ojs/NEWJOURNAL

In the above scheme "ojs" is the location where OJS is installed.

In I have set

Code: Select all

base_url = "http://MYDOMAIN/ojs"
base_url[index] = http://MYDOMAIN/ojs

and in the .htaccess file I have

Code: Select all

Options +FollowSymLinks
RewriteEngine On
RewriteBase /ojs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

As a result, when visiting http://MYDOMAIN/ojs, the URLs are rendered as expected, but all the links are broken -- i.e. nothing changes when I follow any of them, except links that point one or more levels below http://MYDOMAIN/ojs/NEWJOURNAL (such as http://MYDOMAIN/ojs/NEWJOURNAL/issue/current or http://MYDOMAIN/ojs/NEWJOURNAL/user/register). In the latter case, the http://MYDOMAIN/ojs page displays again, but without any influence from the CSS.

I'd appreciate any further hints on how to accomplish the desired result.

Return to “OJS Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests