Restfull_urls, .htaccess, 404 on Administration (Ver. 3.3.0-11)

Just gave up…
I have working OJS 3.1.2-4 with URL rewrite.
On 3.3.0-11 same configuration of config.inc.php and -htaccess just gives 404 or even 500. Tried some 30 solutions and managed to get rid of index.php but administraton section is not working.

For setting up everything, .htaccess is blank, Restfull_urls=Off.
Searched all the internet and seems like I’m the only one with this problem…

1 Like

Hi @Malajlo,

Curious if you’ve seen this post and tried what is suggested here: Restfull urls not working with base_url and mod_rewrite.c - #3 by miren.cava (not entirely sure if that’s what you’re getting at, though…)

-Roger
PKP Team

Hi @Malajlo

Let me start with a disclaimer: Configure a webserver is a task that need to be done by sysadmins so previous technical knowledge is required. I will assume you have a tech profile. At same time, as a community member as you (not pkp staff) I feel asking PKP about how to configure our apaches, nginxs or whatever webserver we decide to use is out of the scope of the help support that we could expect.

Said that, I full empath with you so I will make some recommendations:

  1. Do baby steps. Start with something very simple and then try to grow.
  2. Be sure your OJS is working fine without restfull_urls.
  3. Be sure apache has .htaccess enabled (check if apache2 listens htaccess and do a simple change like setting the error document).
  4. Be sure your .htaccess rules don’t collide with your virtual host ones (aka. use virtualhost or .htaccess but not both).
  5. Be sure your mod_rewrite module is enabled.
  6. Start with very simple rules and then make changes to make them more complex.
  7. If all looks fine but fails, check your ojs config.inc.php (restfull_url, force_ssl…)
  8. If still fails, enable your the rewrite logs (not very verbose) to see how your rules are really applied.

Sorry in advance if you tried it all and those comments don’t help you much.

Please, try with something simple (ie: is htaccess and mod_rewrite enabled) and report back to see if we (as a community) can help you.

1 Like

Thanks for the encouraging words :wink:
I’m pretty familiar with LAMP, but following instructions in FAQ should work.

Everything works OOB, but rewrites just does not work as in older versions. I did even dig into code to find out the difference and fix is included (header.tbl to be specific)
ojs config.inc.php, .htaccess, header.tbl etc. - same settings, same code as on older version but it just behaves unpredictable.
Now I have working rewrite for everything except administration is a mistery. I have to insert index.php into address or turn off rewrite and restfull_urls (as it is rarely needed I can live with it).
Perhaps I should try nginx next time :wink:

So, for others that will face similar problems, my config:

.htaccess

RewriteEngine On RewriteBase / RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L]

It is single journal site and settings for base urls can be omitted (did tried all combinations and it interferes with api and CSS styles… configuring this requires different rewrite).

config.inc.php

; base_url[index] = http://xxx
; base_url[viceversa] = http://xxx
; base_url[myOtherJournal] = http://myOtherJournal.myUrl.com
restful_urls = on

And last not least - don’t use special characters for SMTP password… I spent three hours searching for the root of the problem, there must be some codepage issue in OJS (ssmtp, even telnet worked).

Sorry to ask about your background tech skills.
I need to ask because in a big forum like this we usually have users without the proper knowledge asking.

From your answer I assume you have sysadmin skills so let’s move on.

My first guess is you are missing the “api” redirections but let me start from the ground with some questions to avoid missing something obvious.

Don’t need to answer in detail. A yes/no is a perfectly valid answer.

  • What is your apache version?
  • What is your php version?
  • Are .htaccess rules enabed and working?
  • Is mod_rewrite enabled and working?
  • Are you sure there is no collision with virtualhost?
  • Are you behind any proxy?
  • Are you with http or htttpS?
  • Do you mind to share (via DM if you prefer) the url of your journal?
  • Do you mind to share your .htaccess with the “code” tag or via pastebin?
  • Do you mind to share via pastebin an annonimized version of your config.inc.php?
  • What is your base url and your journal’s url? (full domain? subdomain? folder?)
  • Could you list the urls that fail and the error you get?
  • In case of 500 error, what log says?

Let’s see if we can get the proper picture to help you with this.