OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



mod_rewrite question

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.

mod_rewrite question

Postby nelson » Wed May 16, 2007 1:43 pm

Hallo, I'm going crazy with this case:

There is an Institution: http://www.institution.org

It offers a e-journals service between OJS:

http://www.ojs.institution.org

So each journal has this link:

http://www.ojs.institution.org/index.php/Journal

So they asked to transform this in this other:

http://www.Journal.institution.org

SO, first of all, I asked to the admin of http://www.institution.org to create a second level domain www.Journal.institution.org and point it to the server wich hosts: http://www.ojs.institution.org

Now the Journal address is allowed in the InterNet, but I have to point it to the right address: i.e. http://www.ojs.institution.org/index.php/Journal

I tried Virtual Servers, but each Journal has not an its own directory, and i cannot point the Virtual Server directives to and http:// path, but it has to point at a real filesystem resource.

So I'm trying with mod_rewrite.

I uncommented the lines in conf.inc.php:
base_url[index] = http://www.ojs.institution.org/index.php/index
base_url[Journal] = http://www.Journal.institution.org

But now I don't know how to write the Rules to rewrite them.

Can anyone help me?
Tnx
Alfredo
nelson
 
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am

Postby nelson » Fri May 18, 2007 4:11 am

up
nelson
 
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am

[SOLVED at 50%] a difficult mod_rewrite

Postby nelson » Sun Jul 01, 2007 5:18 pm

Hallo,
i'm going to solve my troubles, just still need a small help again:

RESUME:
a second level domain OJS dedicated server (http://www.ojs.institution.org) has to show journals with second level domains (http://www.journal1.institution.org , http://www.journal2.institution.org, http://www.journal3... etc etc)

RoadMap:
1) Asked to the Admin of http://www.institution.org to create a second-level domain for each journal and point it to the OJS server, so at the end of this step:
http://www.journal1.institution.org -- points to-->www.ojs.institution.org
http://www.journal2.institution.org -- points to-->www.ojs.institution.org

2) After a lot of queries on dedicated forum I saw the light with those mod_rewrite strings:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)\.institution\.org$
RewriteCond %{HTTP_HOST} !^www\.ojs\.institution\.org$
RewriteRule .* /index.php/%1/$1 [QSA,L]

And now:
http://www.journal1.institution.org -- points to-->www.ojs.institution.org/index.php/journal1
http://www.journal2.institution.org -- points to-->www.ojs.institution.org/index.php/journal2
... and so on ...

So it works, there is just a problem:
the container (http://www.ojs.institution.org) works fine, but in the journals: links, css, images are ALL BROKEN :cry:

If I look at rendered html, a css link looks like this:

Code: Select all
<link rel="stylesheet" href="http://www.journal.institution.org/styles/common.css" type="text/css" />


So the problem is that links work only in this 2 ways:
---only relative to real server http path:
Code: Select all
http://www.ojs.institution.org/....

and not the rewrote one

---only absolute on filesystem:
Code: Select all
/style/commons.css

(but this is a problem with variables like $cssUrl)

So the next step is:

a) make work the rewote links

OR

b) change OJS setting to obtain always absolute paths

The second solution seems to be more handle.

So my question is:
How can I hack the $baseUrl and the $cssUrl variables modifying statically the first part of URL to: "www.ojs.intitution.org" ?

thanks
Alfredo
nelson
 
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am

Postby asmecher » Mon Jul 02, 2007 12:45 pm

Hi Alfredo,

I don't have enough experience with mod_rewrite to give you a specific fix, but you should be able to get your static content (e.g. CSS) working with a mod_rewrite rule that supercedes your existing rules for cases where the index.php script is not specified.

Regards,
Alec Smecher
Public Knowledge Project Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8841
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

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