OJS on OVH - removing index.php + ccs

Hello!

I am deploying ojs 3.3.0-20 on ovh.
I had a problem with css when trying https but it was solved by adding this on the .htaccess (thanks to CSS not working - #5 by Abdel)

SetEnv no-gzip 1

However, to remove index.php tried many solutions but I could not get it solved!
when I modify
restful_urls = On
the CSS fails to load in both HTTP and HTTPS.

below are the solutions which I tried, although the index.php disappear but I got this error in the subpage
Not Found The requested URL was not found on this server.

Hello, what do you have in htaccess?

I have tried many options (because of this I have many comments)

here is the last version of .htaccess

#RewriteRule ^*([0-9a-zA-Z_@\-]+)\.htm$ /index.php/$1 [L]
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} -f
#RewriteCond \.(css|js|jpg|png|gif|ico|woff2|ttf|eot|svg)$ - [L]
#RewriteRule ^([0-9a-zA-Z_@\-]+)\.htm$ index.php/$1 [L]
#RewriteEngine On
#RewriteCond %{REQUEST_URI} !/index.php/
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule (.*) /index.php/$1 [L]
<IfModule mode_rewrite.c>
   RewriteEngine On
   #RewriteBase /
   #RewriteCond %{SERVER_NAME} ^(www\.)?journals\.clinicogpub\.com$
   #RewriteRule ^api/v1(.*)$ index.php/journal/api/v1$1 [L,R=307]
   #RewriteCond %{SERVER_NAME} ^(www\.)?journals\.clinicogpub\.com$
   #RewriteCond %{REQUEST_URI} !/journal/
   #RewriteCond %{REQUEST_FILENAME} !-f
   #RewriteRule ^(.*)$ index.php/journal/$1 [L]
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /index.php/$1 [QSA,L]
</IfModule>


#SetEnv no-gzip 1

Here is typo.

That should work IMHO:

<IfModule mod_rewrite.c>
        RewriteEngine On

        # General rule for removing index.php
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

Hello, in the htaccess leave the strictly necessary. Check that the rewrite module is on your server.

Thank you !
Yes, I had a typo
but even after correcting it I am facing the same problem !!
here is my .htaccess

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

I have two problem acctually
problem with css for both http and https (when setting the restful_urls = On)
problem with mydomain.com/subpage (when I click on the page it directs me to its link - without index.php - but says File not found.)

Thank you
I have only this in my .htaccess

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

also I checked rewrite module by creating test-rewrite.php

<?php
echo "mod_rewrite is working!";
?>

when I set .htaccess to

RewriteEngine On
RewriteRule ^test.html$ test-rewrite.php [L]

I get “mod_rewrite is working”

By the way your the configuration you mentioned works well when I install OJS locally using Apache and mysql
But I don’t know what is the problem with ovh cloud!

I found a solution for this (but I assume it is not ideal!):

Instead of setting
restful_urls = On (which creates errors in css loading)

I set
disable_path_info = On
this makes the url having something like ?=

then I add these to the .htaccess

SetEnv no-gzip 1 # This is not related to the url but to load the css in https!
RewriteEngine On
RewriteCond %{QUERY_STRING} ^journal=([^&]+)$
RewriteRule ^$ /%1? [R=301,L]
RewriteCond %{QUERY_STRING} ^journal=([^&]*)&page=([^&]*)$
RewriteRule ^$ /%1/%2? [R=301,L]
RewriteCond %{QUERY_STRING} ^journal=([^&]*)&page=([^&]*)&op=([^&]*)$
RewriteRule ^$ /%1/%2/%3? [R=301,L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ /index.php?journal=$1&page=$2&op=$3 [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ /index.php?journal=$1&page=$2 [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]+)$ /index.php?journal=$1 [L,QSA]

Hi @Hamzaf,

I strongly recommend not using disable_path_info; it’ll break some parts of the interface, and is removed in future versions.

Regards,
Alec Smecher
Public Knowledge Project Team