OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



restful urls not working, version 2.4.3

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
This forum is meant for general questions about the usability of OJS from an everyday user's perspective: journal managers, authors, and editors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OJS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OJS:

1. Read the documentation. We've written documentation to cover from OJS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OJS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OJS Technical Support subforum; if you have a development question, try the OJS Development subforum.

restful urls not working, version 2.4.3

Postby bobmkd » Mon Feb 10, 2014 7:20 am

Hi all,

I have a problem with fresh instalation (and my first) of OJS ver. 2.4.3.
Hosting provider is Hostgator on shared hosting plan.

The problem is with resful urls. I've done the job as stated in some FAQs I found as follows:

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>

BUT with no success.
The OJS is installed in subfolder called "ojs" of my web site, mod_rewrite is installed and enabled on the server and when i go on http://www.mysite.com/ojs i can see the page and everything but no link seams to work.
Every link is striped of "index.php" part but when i click on either one nothing happens, actually just reload the home page of OJS.

Initially installation worked fine, I've created 3 test journals but when i enabled restful_urls in config.inc.php and add .htaccess file, I faced the forementioned problem.

Can anyone help me pls?

Thank You.
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby bobmkd » Tue Feb 11, 2014 4:46 am

I would really appreciate any help, because I'm stuck.
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby asmecher » Tue Feb 11, 2014 10:06 am

Hi bobmkd,

This suggests that the Apache rewriting part of the process is not well configured. Unfortunately we can't provide specific help with Apache configuration or rewrite rules; they're too time-consuming for us to help debug. I'd suggest ensuring that mod_rewrite is properly enabled and that your configuration is being loaded, and if you're still having trouble, search for similar threads in the forum.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9050
Joined: Wed Aug 10, 2005 12:56 pm

Re: restful urls not working, version 2.4.3

Postby bobmkd » Tue Feb 11, 2014 11:26 am

Hi asmecher,

As i wrote in my first post mod_rewrite is properly enabled. When OJS is installed in the root folder of the website everything works properly, as it should, the problem is when OJS is installed in the subfolder of the site.
Now I reproduced the same setting on my local server and I can confirm that when OJS is installed on the root everything is OK, but the problem is when it is installed in the subfolder.
I've tried with RewriteBase /my_subfolder/ in htaccess file but nothing changed.
I can confirm that it is not the issue with apache configuration.
Before I posted here I conduct a thorough search on this forum and on google too, but couldn't find the solution.
Any suggestions would be highly appreciated.

Thank You
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby bobmkd » Wed Feb 12, 2014 10:12 am

asmecher wrote:This suggests that the Apache rewriting part of the process is not well configured. Unfortunately we can't provide specific help with Apache configuration or rewrite rules; they're too time-consuming for us to help debug. I'd suggest ensuring that mod_rewrite is properly enabled and that your configuration is being loaded, and if you're still having trouble, search for similar threads in the forum.


Hi again,

I've tried something else just to be 100% sure that Apache rewriting part of the process is well configured:
In the config.inc.php I set the following line
Code: Select all
disable_path_info = On


Now the links are formatted with classic query string in form: http://my_website/ojs?journal=testj (the index.php part is striped of by "restful_urls = On" directive in config.inc.php) and is working properly. The mod_rewrite does his job and in the browser address bar the address is in the same format - no index.php but is working as it should.
However this is not what I need because I need to register the journals with slashes in format: my_website/ojs/my_journal.
I'm really stuck here, any help pls?

Thanks
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby asmecher » Wed Feb 12, 2014 11:40 am

Hi bobmkd,

OTOH the configuration you describe above will totally avoid your mod_rewrite configuration, as nothing will ever match "index.php/". Instead, Apache will see a query string after a directory and automatically handle it with the index.php script in that directory. I still suspect the configuration issue is in the Apache or mod_rewrite ruleset side of things.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9050
Joined: Wed Aug 10, 2005 12:56 pm

Re: restful urls not working, version 2.4.3

Postby bobmkd » Wed Feb 12, 2014 12:00 pm

Thank you for the answer asmacher, and yes you are totally right with "Apache will see a query string after a directory and automatically handle it with the index.php script in that directory", i just missed that.
I've installed OJS on my local machine with WAMP and there everything works as it should, and I use the same config and .htaccess file. I know that there are huuuge differences between linux and windows hosting (even both are on apache) but .htaccess file should be same right? maybe the apache settings are different but mod_rewrite commands are same?

Thanks again for your effort
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby asmecher » Wed Feb 12, 2014 12:34 pm

Hi bobmkd,

Two things to try:

1) Are you sure your Apache is configured to allow mod_rewrite rules in .htaccess files? You could test with an obviously broken ruleset to see whether it has any effect.

2) Try patching bug #8014 at http://pkp.sfu.ca/wiki/index.php/OJS_2.4.3_Recommended_Patches. This affects Windows hosts only.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9050
Joined: Wed Aug 10, 2005 12:56 pm

Re: restful urls not working, version 2.4.3

Postby bobmkd » Wed Feb 12, 2014 12:41 pm

1. on hostgator i'm sure that Apache is configured to allow mod_rewrite rules in .htaccess files, i'm on the live chat with tech support roght now
on my local windows machine a have this settings in httpd.conf file:
<Directory "my doocument root directory">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
</Directory>
and mod_rewrite.so module is loaded

2. thanks for the tip with pach but the hosting on hostgator where my site is is on centOS linux

thank you
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby bobmkd » Thu Feb 13, 2014 1:02 pm

asmecher wrote:1) Are you sure your Apache is configured to allow mod_rewrite rules in .htaccess files? You could test with an obviously broken ruleset to see whether it has any effect.

Cause I'm really stuck with this problems all days, I decided NOT to trust the tech support guys what they told me "Apache is configured to allow mod_rewrite rules in .htaccess files" and tested with an obviously broken ruleset to see whether it has any effect. The result is: Yes, it has effect, once I get internal server error, then changed ruleset again and get 404.
Anyone else faced the same problem?
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby newbies » Thu Feb 13, 2014 4:29 pm

I have the same problem and have not got it to work after months of troubleshooting.
viewtopic.php?f=8&t=9688
newbies
 
Posts: 84
Joined: Sat Feb 23, 2013 9:15 pm

Re: restful urls not working, version 2.4.3

Postby bobmkd » Fri Feb 14, 2014 1:49 am

newbies wrote:I have the same problem and have not got it to work after months of troubleshooting.
viewtopic.php?f=8&t=9688

Yes, I've already read all about your struggle :shock: before i posted my question. I've thoroughly search all the resources i could imagine off.
I've implemented recommended patches from http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=7073 and after that the cookie path was set to "/" instead of "/ojs" as it was before patching and I thought that will solve the issue but NO, nothing . I guess that even that it says Bug 7073 is for Version: 2.4.x , it is for older versions and different setups.
Newbies, as I've read in your post you have dedicated server, so did you try to put rewrite rules in httpd.conf file or vhost file and not in .htaccess? I don't know if that would make any difference but maybe You should try it, what else can we do :?
And did you try with the settings from my very first post in this topic? (set "restful_urls" to "On" and my .htaccess rewrite commands)
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby bobmkd » Wed Mar 05, 2014 4:22 am

The problem is solved after week of debugging and it comes out that the hosting server was configured to use ORIG_PATH_INFO instead of PATH_INFO and no one from the support team at my hosting provider doesn't mean that it is worth to mention :lol:. They just keep on convinces me that PATH_INFO server variable is configured on the server.

I just put this line at the start of the index.php page and it works:
Code: Select all
<?php
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];


I suppose that I should post my solution here in case anyone else need it (as newbies from above comment)

Regards
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Re: restful urls not working, version 2.4.3

Postby newbies » Sat Mar 15, 2014 7:42 pm

Hi bobmkd,

I should thank you so much for posting this solution which also solved my problem which I have tried to solve in vain in the past year after hours of hours of troubleshooting!!!

You are my hero!
newbies
 
Posts: 84
Joined: Sat Feb 23, 2013 9:15 pm

Re: restful urls not working, version 2.4.3

Postby bobmkd » Tue Mar 18, 2014 2:23 pm

No problem newbies, you are welcome.
@asmecher It seems that maybe the team should consider implementing some kind of solution to this problem in some future version of OJS?
Just a suggestion that could save some users a lot of time and nerves.

Regards,
Bob
bobmkd
 
Posts: 10
Joined: Mon Feb 10, 2014 6:50 am

Next

Return to OJS Editorial Support and Discussion

Who is online

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