OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



could not get mod_rewrite to work

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.

Re: could not get mod_rewrite to work

Postby Garant » Tue Aug 27, 2013 12:24 am

Hi, newbies!
I'm running the same situation. Have you found a workaround with .htaccess?
Garant
 
Posts: 228
Joined: Wed May 30, 2012 8:53 am

Re: could not get mod_rewrite to work

Postby newbies » Wed Aug 28, 2013 10:04 am

Garant wrote:Hi, newbies!
I'm running the same situation. Have you found a workaround with .htaccess?

No. I ended up giving up. OJS people here suggest that we look into out mod_rewrite settings. I spent a lot time on this and found there is no much you can do with mod_rewrite in terms of configuration. I increased logging level for mod_rewrite in apache conf, no much useful information can be found in the log. The root of the problem is redirect looping and that is why using absolute URL in the rewrite rule partially solved the problem. But that is not the right solution. it is very frustrating.
newbies
 
Posts: 86
Joined: Sat Feb 23, 2013 9:15 pm

Re: could not get mod_rewrite to work

Postby asmecher » Wed Aug 28, 2013 10:26 am

Hi all,

Redirect looping is likely related to the cookie path being used for the login cookie. There's a patch here to add an optional configuration directive to specify it manually.

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

Re: could not get mod_rewrite to work

Postby newbies » Wed Aug 28, 2013 8:04 pm

asmecher wrote:Hi all,

Redirect looping is likely related to the cookie path being used for the login cookie. There's a patch here to add an optional configuration directive to specify it manually.


Thank you very much for pointing me to that patch. But I am still at a loss. Are you referring to this directive
Code: Select all
And in config.inc.php, add a new variable:
; Variable to allow multiple OJS sites with RESTful URLs in a multisite configuration:
    session_cookie_path = /

But that seems for setting up multiple journals on one installation situation which differs from mine. I added that directive (exactly as "session_cookie_path = /" ) to my config.inc.php file, it made no difference.
newbies
 
Posts: 86
Joined: Sat Feb 23, 2013 9:15 pm

Re: could not get mod_rewrite to work

Postby asmecher » Thu Aug 29, 2013 9:15 am

Hi newbies,

You can verify whether the patch and configuration addition are behaving as intended by looking at the "OJSSID" cookie using your browser. Check that the cookie path is set appropriately. (You may have older cookies hanging around from your configuration work -- if so, get rid of them to make sure they aren't interfering.)

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

Re: could not get mod_rewrite to work

Postby newbies » Thu Aug 29, 2013 3:39 pm

You can verify whether the patch and configuration addition are behaving as intended by looking at the "OJSSID" cookie using your browser. Check that the cookie path is set appropriately. (You may have older cookies hanging around from your configuration work -- if so, get rid of them to make sure they aren't interfering.)


Do you mean there is patch besides the addition to the config.inc.php file? If yes, where it is?

I already did cookies cleanup several times to several of my browsers. I checked my browser's cookies, the name is OJSSID, path is /.
newbies
 
Posts: 86
Joined: Sat Feb 23, 2013 9:15 pm

Re: could not get mod_rewrite to work

Postby asmecher » Fri Aug 30, 2013 11:48 am

Hi newbies,

The patch is at https://github.com/pkp/pkp-lib/commit/67c96f2933d2c60d449968eb0a8b5dbe456e9f47.diff (to be applied in lib/pkp). Without that, the new configuration directive won't be used. However, if your cookie path is already "/", then it's not likely to be the problem. Have you tried temporarily disabling the SSL logins to see if that simplifies the situation?

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

Re: could not get mod_rewrite to work

Postby newbies » Fri Aug 30, 2013 2:02 pm

Yes, the cookie path is already "/"

I have also disabled SSL and the problem is still there.

I have installed OJS 2.4.2 and 3.0 for two different domains on the same dedicate sever which I have full control of. Both installations have the same looping redirect issue. Is there anything else I should look into to get this to work?
newbies
 
Posts: 86
Joined: Sat Feb 23, 2013 9:15 pm

Re: could not get mod_rewrite to work

Postby asmecher » Fri Sep 06, 2013 2:18 pm

Hi newbies,

Mind sending me a URL I can use to test?

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

Re: could not get mod_rewrite to work

Postby newbies » Sat Sep 21, 2013 12:41 am

I tried any possible .htaccess grammar found on the internet, and even upgraded my apache server to the latest 2.4.2 version which contains several important upgrades to mod_rewrite, hoping to solve the redirect loop issue in vain. I finally was able to turn on mod_rewrite logging and obtained the log as follows:
Code: Select all
[Sat Sep 21 00:08:53.413993 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a725b0/initial] [perdir /home/mysite/public_html/] strip per-dir prefix: /home/mysite/public_html/journal -> journal
[Sat Sep 21 00:08:53.414013 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a725b0/initial] [perdir /home/mysite/public_html/] applying pattern '^(.*)$' to uri 'journal'
[Sat Sep 21 00:08:53.414039 2013] [rewrite:trace2] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a725b0/initial] [perdir /home/mysite/public_html/] rewrite 'journal' -> '/index.php/journal'
[Sat Sep 21 00:08:53.414051 2013] [rewrite:trace2] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a725b0/initial] [perdir /home/mysite/public_html/] trying to replace prefix /home/mysite/public_html/ with /
[Sat Sep 21 00:08:53.414061 2013] [rewrite:trace1] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a725b0/initial] [perdir /home/mysite/public_html/] internal redirect with /index.php/journal [INTERNAL REDIRECT]
[Sat Sep 21 00:08:53.414109 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a740c8/initial/redir#1] [perdir /home/mysite/public_html/] add path info postfix: /home/mysite/public_html/index.php -> /home/mysite/public_html/index.php/journal
[Sat Sep 21 00:08:53.414122 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a740c8/initial/redir#1] [perdir /home/mysite/public_html/] strip per-dir prefix: /home/mysite/public_html/index.php/journal -> index.php/journal
[Sat Sep 21 00:08:53.414132 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a740c8/initial/redir#1] [perdir /home/mysite/public_html/] applying pattern '^(.*)$' to uri 'index.php/journal'
[Sat Sep 21 00:08:53.414151 2013] [rewrite:trace1] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a740c8/initial/redir#1] [perdir /home/mysite/public_html/] pass through /home/mysite/public_html/index.php
[Sat Sep 21 00:08:53.414206 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/subreq] [perdir /home/mysite/public_html/] strip per-dir prefix: /home/mysite/public_html/journal -> journal
[Sat Sep 21 00:08:53.414230 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/subreq] [perdir /home/mysite/public_html/] applying pattern '^(.*)$' to uri 'journal'
[Sat Sep 21 00:08:53.414249 2013] [rewrite:trace2] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/subreq] [perdir /home/mysite/public_html/] rewrite 'journal' -> '/index.php/journal'
[Sat Sep 21 00:08:53.414260 2013] [rewrite:trace2] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/subreq] [perdir /home/mysite/public_html/] trying to replace prefix /home/mysite/public_html/ with /
[Sat Sep 21 00:08:53.414267 2013] [rewrite:trace1] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/subreq] [perdir /home/mysite/public_html/] internal redirect with /index.php/journal [INTERNAL REDIRECT]
[Sat Sep 21 00:08:53.492920 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/initial] [perdir /home/mysite/public_html/] strip per-dir prefix: /home/mysite/public_html/journal -> journal
[Sat Sep 21 00:08:53.492937 2013] [rewrite:trace3] [pid 22466] mod_rewrite.c(468): [client 76.126.33.175:3959] 76.126.33.175 - - [www.mysite.com/sid#9a22888][rid#9a80650/initial] [perdir /home/mysite/public_html/] applying pattern '^(.*)$' to uri 'journal'


here are all the grammar I tested in .htaccess (some of the sentences were not used at same time, but one by one)
Code: Select all
Options +FollowSymLinks
RewriteEngine On
#RewriteBase /

# Use this set of 3 lines for each of your journals
#RewriteCond %{SERVER_NAME} ^www.mysite.org
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !=/index.php
#RewriteCond %{REQUEST_URI}  !^/index.php/.*
#RewriteRule ^(.*)$ index.php/$1" [L,NS]
#RewriteRule ^(.*)$ index.php/$1 [L,QSA]

# Use this set of 3 lines to allow access to the site level
#RewriteCond %{SERVER_NAME} ^www.mysite.org
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ "/index.php/index/$1" [QSA,L]

#RewriteCond %{SERVER_NAME} ^www.mysite.org
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
#RewriteCond %{REQUEST_URI} index.php
RewriteRule ^(.*)$ /index.php/$1 [QSA,L]
#RewriteCond %{REQUEST_URI} !=/index.php
#RewriteRule ^(.*)$ index.php/$1" [L,PT] 


Please help me, I need to get this to work, otherwise, this hurts search engine ranking.
newbies
 
Posts: 86
Joined: Sat Feb 23, 2013 9:15 pm

Previous

Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 3 guests