Please, How To Direct Single Journal To Web Root (http://journalpage.com) instead of (http://journalpage.com?index.php/ojs)

Can you clarify exactly what you changed, what you were expecting, and what you see instead?

The link you provided currently appears to point to a vanilla OJS 3.x install.

Not sure if this is the right place, but we moved a (single) journal install to another place and did some changes. later on, we unfortunately noticed that we accidental changed the journal path. We now have links to articles with both /path1/ and /path2/ and I am looking for a code to redirect path2 to path1 so indexed urls will still be valid.

I tried with a .htaccess file, but can’t get that to work and likely don’t understand enough about how OJS redirects urls, though, since it’s a single journal install I am hoping it won’t be too difficult.

Thanks for your help!

This would be better as a new thread, though many of the concepts you read here will be used. If you have access to mod_rewrite, you can do this within your .htaccess file. Please open a new thread specific to this issue; feel free to tag me.

Thanks, created a new topic here: One journal, two paths

Dear friends,

is this still guide the definitive way to solve the website url issue for single journals? Does it apply also for OJS 3.0?

This advice applies to both 2.x and 3.x.

Dear friends,

I am amazed, because after some hours of working around I have managed to do everything: I removed the index.php part of the url and even the Journalpath.
Now I have the url I always wanted.
However, visually the site broke. All the style was broken.
I am fighting.

Hi @leonardo.mancini

Could you look at that solution?
Regards,

and you might need to modify config.inc.php as well.

Hi @drugurkocak,

many thank for this advise. I am reading the two threads and I am amazed by the amount of work.
The second thread (SOLVED: Upgrade from OJS 3.1.2.4 to OJS 3.2.1.2: problems with url api in back-office - #13 by drugurkocak), in your final post, is more clear to me, but I read that you say that that solution is not working yet on single journals installation only, which is my current case.

I have to say that before, an hour ago, I did manage to delete all the index.php/journalpath, but the style of the website was broken.
So now I have done a step backwards and I have restored the journalpath. This is my single journal site, installed in a subdirectory: https://www.ista-online.org/journal/jta

I am looking forward to delete that “jta” (which is my journalpath) away.
Many thanks for now, I will keep studying your documentation.
Best wishes,
Leonardo

Hi @leonardo.mancini

Can you modify and test that scenario on your OJS installation?

Please consider that your server configuration is also important for the result. This solution is for a Linux Apache webserver.

Sample configuration to remove index.php and journal path on Single OJS Journal

domain: https://www.cancer-research.net
journal path: jcr

PHP script execution mode : CGI wrapper (run as virtual server owner)

HTACCESS

# OJS 3.2.1.2 remove journal path

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

# Bugfix for OJS 3.2.0-3: submissions API doesnt work with shortened URLs

RewriteCond %{SERVER_NAME} ^(www\.)?cancer-research.net

RewriteRule ^api/v1(.*)$ index.php/jcr/api/v1$1 [L,R=307]

# Rewrite URL to look cleaner
RewriteCond %{SERVER_NAME} ^(www\.)?cancer-research.net
RewriteCond %{REQUEST_URI} !/jcr/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/jcr/$1 [L]


RewriteRule ^api/v1(.*)$ index.php/index/api/v1$1 [L,R=307]


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

</IfModule>

CONFIG.INC.PHP
base_url = "https://www.cancer-research.net"
base_url[index] = https://www.cancer-research.net/index
base_url[jcr] = https://www.cancer-research.net
restful_urls = On
 
 htaccess directives for apache virtual host:

 Options +ExecCGI +FollowSymLinks +IncludesNOEXEC -Indexes +SymLinksIfOwnerMatch
  allow from all
 AllowOverride All
 Require all granted

Regards,

Update: I get success when modified and applied them.
You may check it at;
https://www.cancer-research.net
for a temporary time.
username: sysmanager
pass: 123456
You may try to change everything in the settings.
Let’s thank to @KBodarwe and @klausru again :slight_smile:
Regards,

Dear @drugurkocak,

Many thanks, I will follow this and let you know.
Do you think that I could do even if I install my OJS in a subdomain? In my case that would be: https://jta.ista-online.org.

Best wishes, many thanks,
Leonardo

Hi @leonardo.mancini

I applied the same configuration on https://journals.adlitip.net and seems to run properly.

I replaced cancer-research.net with journals.adlitip.net

So, the new line has become like;

RewriteCond %{SERVER_NAME} ^(www\.)?journals.adlitip.net

Config
base_url = “https://journals.adlitip.net
base_url[index] = https://journals.adlitip.net/index
base_url[jfm] = https://journals.adlitip.net

You may check it at https://journals.adlitip.net/
for a temporary time.
username: sysmanager
pass: 123456
Regards,

1 Like

Hi @drugurkocak,

At the moment I am stuck, with an error (The server encountered an internal error or misconfiguration and was unable to complete your request; Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request).
I am working around following your guide, which logic I am understanding. I am running on a Linux hosting. What I am not sure yet is first of all the part about “PHP script execution mode : CGI wrapper (run as virtual server owner)”. I am trying to see with my Hosting if I can abilitate this somehow.

Then, I have a question for you about the config.inc.php file. If I search “base_url” inside that file, it will appears the following times:

  1. Line 32, where it says: The canonical URL to the OJS installation (excluding the trailing slash)
    base_url = “https://jta.ista-online.org
  2. Line 79, where I have deleted the ; and where it says: Syntax: base_url[jta] = https://jta.ista-online.org
  3. Lines 83-85:

base_url[index] = https://jta.ista-online.org/index
base_url[jta] = https://jta.ista-online.org
; base_url[myOtherJournal] = http://myOtherJournal.myUrl.com

At line 90 I have: restful_urls = On

Do this configuration looks good for you?
Just to be sure that this is ok and that I have to focus on the .htaccess, which is easier for me to follow on your example.
Thank you very much. and best regards.
Leonardo

ps.: I have adjusted the .htaccess as follows:

# OJS 3.2.1.2 remove journal path

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

# Bugfix for OJS 3.2.0-3: submissions API doesnt work with shortened URLs

RewriteCond %{SERVER_NAME} ^(www\.)?jta.ista-online.org

RewriteRule ^api/v1(.*)$ index.php/jta/api/v1$1 [L,R=307]

# Rewrite URL to look cleaner
RewriteCond %{SERVER_NAME} ^(www\.)?jta.ista-online.org
RewriteCond %{REQUEST_URI} !/jta/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/jta/$1 [L]


RewriteRule ^api/v1(.*)$ index.php/index/api/v1$1 [L,R=307]


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

</IfModule>

CONFIG.INC.PHP
base_url = "https://jta.ista-online.org"
base_url[index] = https://jta.ista-online.org/index
base_url[jta] = https://jta.ista-online.org
restful_urls = On
 
 htaccess directives for apache virtual host:

 Options +ExecCGI +FollowSymLinks +IncludesNOEXEC -Indexes +SymLinksIfOwnerMatch
  allow from all
 AllowOverride All
 Require all granted

Hi @leonardo.mancini
As a quick look, the .htaccess file should end at;

The remaining lines are related to config.inc.php and httpd.conf file.
Do they exist in .htaccess file? Can you check?
I use Virtualmin panel. If you use Cpanel or Plesk, you may need to find it and change php execution mode to CGI
For ex;

Regards,

Hi @drugurkocak,

Thank you so much for the quick answer. Sorry, I missed out the closing tag. Now I have added it.

In my previous post I attached also by mistake the lines related to config.inc.php in my model of the .htaccess file, but of course they are not present there.

Now my site is running well: https://jta.ista-online.org

However, it does add the /jta suffix when you start navigating around in the inner pages.
Do you see something else that I should edit?
Thank you very much, really.
Best wishes
Leonardo

P.s. I did enter in your test site, thank you for that.

Hi @drugurkocak,

Edit: SOLVED…!!!
I followed with extreme care your models and guide, and I managed!
I am most thankful to you.
With my best regards,
Leonardo

Hi @leonardo.mancini

It seems that the directives in your htaccess file have no effect. That might be probably due to php execution mode, or AllowOverride settings. For that reason, I shared that directives too.
For ex; when I change php execution mode to FastCGI, I see “No input file specified.” message on a white page. The site doesn’t open at all. So, you should adjust these settings too.

For ex, in virtual host configuration you need to insert such lines; the path might be different in your server. Then, it will probably run well.

<Directory "/home/xxxxx/domains/journals.domain.net/public_html">
Options +ExecCGI +FollowSymLinks +IncludesNOEXEC -Indexes +SymLinksIfOwnerMatch
allow from all
AllowOverride All
Require all granted
</Directory>
    
<Directory /home/xxxxx/domains/journals.domain.net/public/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>

Regards,

1 Like

I am glad to heard that it worked. :slight_smile:
Regards,

1 Like

Yes, but also thank you very much for your very last post, which indeed will be for sure useful for future reference.
By the way, I am really most grateful to you: I have learned and I have managed what I wanted to obtain!
This is something that will be for sure very useful for a lot of persons.
With my best wishes,
Leonardo

1 Like

Sorry to resurrect an old thread. This is really useful, but as someone mentioned many posts earlier, it does block access to the admin page which gives a 404 on /index/admin/index

Do you know what I’d need to do to prevent this?

Many thanks