• I am facing a problem when removing index.php from the OJS urls in OJS 3.1.2.

    I want to install my WordPress on the main domain i.e. https://www.myjournal.com and then OJS on a subdirectory i.e. https://www.myjournal.com/journal/.

    Wordpress has its own .htaccess file i.e.

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

    Now in config.php file of OJS I enabled the restfulurls to be On and placed a new .htaccess file in the https://www.myjournal.com/journal/ directroy with following code:

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

    By this way, the index.php in urls is removed but, the OJS journal website is now showing page not found error and url is rendered by WordPress site.

    Kindly help me to resolve the issue and tell me if my code are correct? How I can disable WordPress .htaccess to include OJS urls?

    Regards
    Pankaj

Viewing 4 replies - 1 through 4 (of 4 total)
  • .htaccess is a tool that is only used on the web server Apache (and even there, it needs to be enabled in the configuration). If your host is using some other web server, for instance nginx, then the corresponding fixes that enable permalink structure, etc, need to be set up in a different way.

    So you should probably check with your web hosting provider.

    Prove this

    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /journal/
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /journal/index.php/$1 [QSA,L]
    </IfModule>
    • This reply was modified 4 years, 5 months ago by autotutorial.
    • This reply was modified 4 years, 5 months ago by autotutorial.
    Thread Starter kumarpankajgkv

    (@kumarpankajgkv)

    Hi @autotutorial

    I followed your code, now it is showing Error too many redirects.

    I think I have to exclude the https://www.myjournal/journal/ directory from WordPress rewrite rules first.

    I have tried this code too , but no sucess.

    RewriteRule ./journal/index.php [L]

    and this too:

    RewriteCond %{REQUEST_URI}!^/journal/

    htaccess file in child folder overrides parent directory directives, is journal a real directory? -d means if not directory -f means if not a regular file for apache if it is true I rewrite the url. however you don’t need the QSA flag.
    RewriteRule ^(.*)$ /journal/index.php [L]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘.htaccess rewrite not working for WordPress in root and OJS on sub-directory?’ is closed to new replies.