Redirects, new sites and .htaccess file

So, after lots of problems and different cases I came to the conclusion that I don’t really understand how the .htaccess and paths works in OJS. I couldn’t create a new journal because of some wrong settings in .htacces that I fixed (see https://forum.pkp.sfu.ca/t/cannot-create-new-journal/75798/4). Now, the situation is that:

  • I have a journal with a custom domain, all set and working;
  • I have two journal within a general domain, reachable at www.journals.com/nameofjournal as the “normal” setting of ojs should work. Those journals gets redirected at www.journals.com/index.php/nameofjournal
  • I have a brand new journal within the general domain, but it doesn’t get redirected to /index.php/, all the urls inside ojs to reach the journal try to get the page www.journals.con/brandnewjournal, and it gives 404. When I write the url by hand with /index.php/ the css are not loading and I get general errors in the admin backend.

This is my .htaccess (I think that the problem is here, but I don’t actually know for sure):

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	

	######### ADMIN NO CONTEXT / THIS IS TO FIX THE IMPOSSIBILITY TO CREATE A NEW JOURNAL

	RewriteRule ^_/api/v1/(.*) index.php/_/api/v1/$1 [L,R=307]
	
	## Journal has its own domain	
	RewriteRule ^api/v1(.*)$ index.php/aldrovandiana/api/v1$1 [L,R=307]
	
	RewriteCond %{SERVER_NAME} ^(www\.)?aldrovandiana.it
	RewriteCond %{REQUEST_URI} !/aldrovandiana
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ /index.php/aldrovandiana/$1 [QSA,L]
	
	##Mainsite with journal overview and admin
	RewriteCond %{SERVER_NAME} ^(www\.)?journals.buponline.com
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^index/(.*)$ /index.php/index/$1 [QSA,L]
</IfModule>

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>


<IfModule mod_php.c>
   php_value upload_max_filesize 40M
   php_value post_max_size 40M
</IfModule>

I don’t know if any of this is comprehensible, if not I will try to explain better. I have a really hard time to figure it out why there are so much “index” in the ojs urls and how they works.
Thanks.

So, I figured it out: it was necessary to add the base_url in the config.inc.php file.

1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.