You are viewing the PKP Support Forum | PKP Home Wiki

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
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

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

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

Is it possible?
Posts: 1
Joined: Sat May 05, 2007 1:32 am

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: 10015
Joined: Wed Aug 10, 2005 12:56 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: 51
Joined: Sat Apr 28, 2007 9:01 pm

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 config.inc.php 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.
Posts: 44
Joined: Mon Oct 29, 2007 6:04 am


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests