Clear URL for index.php/index

Hello, for optimal SEO results i have been asked to remove the “index.php/index/page/view/” in the URL. How can i do that?
Example 1:
Wrong: http://www.oajpc.com/index.php/index/page/view/downloads
Correct: http://www.oajpc.com/downloads

Example 2:
Wrong: http://www.oajpc.com/index.php/FMCRJ
Correct: http://www.oajpc.com/FMCRJ

1 Like

There is a setting called “restful_urls” in config.inc.php which allows removal of the index.php URL component when accompanied by a mod_rewrite Apache configuration (or similar configuration for your server environment).

Removing all of the REST components as in your Example 1 is a little aggressive.
https://moz.com/blog/should-i-change-my-urls-for-seo
It is possible, however, to also create arbitrary vanity URLs such as this via mod_rewrite or similar. You can find a parallel discussion here:

@ctgraham you are the best. I fixed it!. 10x…

Now I have two problems:

  1. How can I increase the number of characters allowed for the field “PATH” in Journal Settings ? Now, the number of characters allowed is 32 and I need to be 71 characters.

  2. How can I remove the “index/” (not “index.php”) and “page/view/” in the URLs:
    WRONG:
    http://mydomain.com/index/login
    http://mydomain.com/index/user/register
    http://mydomain.com/index/search
    http://mydomain.com/index/user/register
    http://mydomain.com/index/page/view/pricing
    http://mydomain.com/index/page/view/Advertising
    http://mydomain.com/index/page/view/Jobs
    http://mydomain.com/index/page/view/authors-guidelines
    http://mydomain.com/index/page/view/readers-guidelines
    http://mydomain.com/index/page/view/reviewers-guidelines

CORRECT:
http://mydomain.com/login
http://mydomain.com/user/register
http://mydomain.com/search
http://mydomain.com/user/register
http://mydomain.com/page/view/pricing
http://mydomain.com/Advertising
http://mydomain.com/Jobs
http://mydomain.com/authors-guidelines
http://mydomain.com/readers-guidelines
http://mydomain.com/reviewers-guidelines

Best regards !

To change the length of the Path, you would need to modify the database (journals.path) and the Journal Settings Form template (ojs/journalSettings.tpl at ojs-stable-2_4_6 · pkp/ojs · GitHub)

In trying to create the vanity URLs in your second question, you are losing a large amount of RESTful context, and not really gaining substantial SEO improvements.

The initial “index” component of the URL indicates the Site level context for the remainder of the URL, as opposed to a Journal level context, for example.

If you can discriminate between the Site and Journal contexts via the domain name, you can readily remove the “index” context via mod_rewrite and the base_url settings in config.inc.php. For example, this would be the case if you had one site install with two journals, with base urls of:

There is no mechanism in the software to create vanity URLs which automatically strip the RESTful context from pages, but you can create the URL rewrites by adding additional mod_rewrite rules, and then when adding links in the menu or in HTML you would need to manually reference those links. The pages would still be available at their original URI, and could be indexed as such if these links are crawled. I think this would get you 90% of the way there, though I think it would be a lot of effort for minimal benefit.

Just linking to the FAQ where this is now covered:

https://github.com/pkp/ojs/blob/master/docs/FAQ

  1. 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>
1 Like