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

I think that change should work as-is. (I’m pretty sure the $hasOtherJournals variable is available before 2.4.8-1.)

When logged into your journal, the link should be constructed as $base_url[aro] + “/user”.

Did that work?

Yes that solved the issue with user site, and now I can add the /index to base_url[index] in config as

base_url[index] = http://aro.koyauniversity.org/index
base_url[aro] = http://aro.koyauniversity.org
restful_urls = on

but still I have to have redirection to my htaccess to make the short URL work

RewriteEngine On
RewriteCond %{HTTP_HOST} ^aro.koyauniversity.org$
RewriteRule ^$ http://aro.koyauniversity.org/index [L,R=301]

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^/index/(.*)$ /index.php/index/$1 [L]

	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ /index.php/aro/$1 [L]
</IfModule>

BTW, in the direction you have provided on MAY 15 above on the last line one have to have it should be a / after SHORTNAME to read as below, without it it does not work

RewriteRule ^(.*)$ /index.php/SHORTNAME/$1 [L]

1 Like

Hi guys
Thank you very much for these elements, but as I have the same issue, nothing proposed in the several messages on the forum is working for me.
I have freshly installed OJS 3.0.2 on an Apache Server to use it for only one journal.
My conf. :

With the solution provided in the former message, I have to many redirection

I wish there would be an easier build-in solution for single journal installations.

Thank you very much for your help.

Has anyone successfully done this on OJS3.0? By not having a clean URL, SEO ranking will be affected too. This should be a part of the design itself. Any thoughts? Feedback? Thank you.

Were you able to resolve this? We are in the same situation :frowning:

Hi All,

We’ve struggled with a single journal site with pretty URLs for ages, tried various solutions posted in this thread and other places but had lots of errors all over the place.

Here’s what currently works best for us, haven’t had any error so far:

Site: https://ijpds.org
Journal Name: ijpds

Apache rewrite config:

    RewriteEngine on

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

    RewriteRule "^\/$" "/index.php/ijpds/" [PT]

    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !api/v1/
    RewriteRule ^(.*)$ /index.php/ijpds/$1 [QSA]

OJS conf file snippets:

base_url = “https://ijpds.org
base_url[index] = https://ijpds.org/index
base_url[ijpds] = https://ijpds.org
restful_urls = On

It’d be nice to hear from others what they had to do! :slightly_smiling_face:

Thanks @imranh! Your recipe worked! Only in the URL to the main page appears the second slash before ‘index’, for your example International Journal of Population Data Science and it appears in the URL everywhere except for static pages

Glad to hear it worked :slight_smile:!

Not the end of the world, I think this’ll fix it if it bothers you:

Change RewriteRule ^(.*)$ /index.php/ijpds/$1 [QSA] to RewriteRule ^(.*)$ /index.php/ijpds$1 [QSA]

@imranh I tried this option. The site is loaded, but unfortunately all styles and some scripts (except external) are not loaded. Also, the navigation menu is not loaded in the frontend and all that is generated via JavaScript is not loaded in the backend ((
By the way, in the original solution some of the added scripts cease to work, for example, lightgallery.js issue an error SecurityError (DOM Exception 18): Blocked attempt to use history.replaceState() to change session history URL to http://article/view/42#lg=1&slide=0. Protocols, domains, ports, usernames, and passwords must match. in the console.

This is a setup that works for me with OJS 3.1.1.2. It includes a redirect to handle the troublesome API calls that have been returning an error in some cases. I do not have this in production use, so comments are welcome. Just a pointer that this was very handy while testing the rules: https://htaccess.madewithlove.be/

config.inc.php

base_url = "http://domain.net"
base_url[JOURNALPATH] = http://domain.net

.htaccess

RewriteEngine On

# Redirect calls to domain root to /index path
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.net [NC]
RewriteRule ^/?$ http://domain.net/index [L,R=301]

# Redirect api calls
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} api/v1/
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

# Redirect ordinary calls with a path
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/JOURNALPATH/$1 [QSA,L]

Edit: this works up to the point that if you go to your dashboard and try to access the administration tab, you will get a 404 because of the redirect above. It can be probably fixed with some additional redirects. Of course in a single journal installation, there is a limited need for access to the admin tab anyway, I guess.

1 Like

I tried using these (both the above) codes @imranh and @ajnyga , however it doesnt work.

The articles are available on www.domain.com/article/view/243 for ex, however the redirects are not working, so it still shows www.domain.com/journalpath/article/view/243 and gives a 404 Not found error.

Error logs:

[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Smarty has a deprecated constructor in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php on line 64
[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADODB_Cache_File has a deprecated constructor in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/lib/adodb/adodb.inc.php on line 263
[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADOConnection has a deprecated constructor in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/lib/adodb/adodb.inc.php on line 359
[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet has a deprecated constructor in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/lib/adodb/adodb.inc.php on line 2921
[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ADORecordSet_array has a deprecated constructor in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/lib/adodb/adodb.inc.php on line 3939
[30-Dec-2018 12:08:34 UTC] PHP Warning: Declaration of PKPUsageEventPlugin::getEnabled() should be compatible with LazyLoadPlugin::getEnabled($contextId = NULL) in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php on line 386
[30-Dec-2018 12:08:34 UTC] PHP Warning: Declaration of DRIVERDAO::setOAI(&$oai) should be compatible with PKPOAIDAO::setOAI($oai) in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/driver/DRIVERDAO.inc.php on line 19
[30-Dec-2018 12:08:34 UTC] PHP Warning: Declaration of OpenAIREDAO::setOAI(&$oai) should be compatible with PKPOAIDAO::setOAI($oai) in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/openAIRE/OpenAIREDAO.inc.php on line 100
[30-Dec-2018 12:08:34 UTC] PHP Warning: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134
[30-Dec-2018 12:08:34 UTC] PHP Warning: Declaration of CustomBlockPlugin::getEnabled() should be compatible with BlockPlugin::getEnabled($contextId = NULL) in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Notice: Only variables should be passed by reference in /home/u741823471/domains/jmedresinnovation.org/public_html/plugins/generic/customBlockManager/CustomBlockManagerPlugin.inc.php on line 65
[30-Dec-2018 12:08:34 UTC] PHP Deprecated: Non-static method PKPRequest::_checkThis() should not be called statically in /home/u741823471/domains/jmedresinnovation.org/public_html/lib/pkp/classes/core/Dispatcher.inc.php on line 245
[30-Dec-2018 12:08:34 UTC] ojs2: 404 Not Found

Hi,

Yeah, I do not think I ever considered how to redirect the old url’s to the new ones when they are indexed for example by google. Of course that is important with old sites.

It will be great if thats possible. Somehow if we can redirect domain.com/path/anything to domain.com/anything.

Hi All,

(http://www.proceedings.pub)

We changed in the OJS configuration file and managed to remove index.php; however, the whole theme changed to the current design.

Please advice us with the right code that we should add to our hta access taking into consideration that we are using Hostgator shared business plan.

Many thanks and best wishes

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.