Dear staff,
I installed the ojs 3.0.2.0 in www.XXX.com/journals/. There are some journals in url like www.XXX.com/journals/index.php/journal 1
Everything is very good. But I wish to remove index.php in url. I have tried to follow the instruction in forum to set config.inc.php and create .htaccess to remove index.php in url. No matter what I set, I always get the same results
it has removed the index.php in url from link of www.XXX.com/journals/, e.g. the link become www.XXX.com/journals/journal 1, but the webpage showed "No input file specified. ".
Could you give me some more instruction about removing index.php?
Yes, I followed this method. But the webpage loss all css style and the url without index.php showed "No input file specified. " Did you test this method in ojs 3.0.2.0?
Dear Ajnyga. I will very appreciate if you would tell me the exact setting.
By the way, do you know how to set subdomain for each journals? I think this is also a problem related with URL rewriting.
Thank you in advance.
Best regards
Dear ajnyga
Are you happy to help me further to set everything about subdomain and removing index.php? My email address is libuyi2008@gmail.com. If you are happy to help, please contact me.
Thank you in advance.
Best regards
I can post our .htaccess and config.inc.php settings here. Setting up wildcard subdomains depends on your service provider so I can not help you much there.
Thank you for your kind reply. Could you tell me more details about wildcard subdomains which I will forward to my service provider? I don’t know much in this area.
Here are the settings from my .htaccess and config.inc.php that are related to the issue:
Contents of .htaccess
RewriteEngine On
RewriteBase /
# List of actual folders I want to access (like http://mydomain.com/folder1/)
RewriteRule ^(folder1|folder2|folder3)($|/) - [L]
# Redirect www.mydomain.com to mydomain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Remove index.php
RewriteCond %{SERVER_NAME} ^mydomain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
# Handle subdomains
RewriteCond %{SERVER_NAME} ^([a-z0-9-]+)\.mydomain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/%1/$1 [L]
The first rule is just for ensuring I can access a few folders, not necessary.
The second rule just redirects www.domain.com to just domain.com, not necessary
The third set of rules removed index.php, you could use just that if it is enough
The fourth set of rules handles the subdomains. For this to work you need to define the subdomains in config.inc.php and have wildcard domains active.
Contents of config.inc.php (not all of it of course)
Here the most important setting is the restful_urls setting. You need it to be on both when you are removing index.php and/or are using subdomains.
The base_url settings for the journals are necessary only if you are using subdomains. However, if you choose to use subdomains and define even one of them here, you need to define all of the journals base_url’s. If you do not, all the other journals will stop having their metrics saved.
In this example journal3 and journal4 are using subdomains. The two other journals are using the ordinary url.
I am happy to hear if I could make the settings better somehow or if there are any problems I have not seen, @ctgraham? For us these settings seem to work.
Edit: I see now that our settings were actually a bit different, but I am fairly sure that these are originally form some thread in the forums.
I just can’t figure out why I ended up removing RewriteCond %{REQUEST_FILENAME} !-d and adding the rule for specific folders. I probably have to test and see if it makes a difference. I already wrote that almost a year ago for OJS2.
With OJS 3.1.1.2 there will be errors if you use the settings I posted above. These are the ##api.submissions.unkownError## errors that a lot of users have encountered.
This is the new config that seems to work.
RewriteEngine On
RewriteBase /
# List of actual folders I want to access (like http://mydomain.com/folder1/)
RewriteRule ^(folder1|folder2|folder3)($|/) - [L]
# Redirect www.mydomain.com to mydomain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Remove index.php
RewriteCond %{SERVER_NAME} ^mydomain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
# Handle api calls in subdomains
RewriteCond %{SERVER_NAME} ^([a-z0-9-]+)\.mydomain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} api\/v1\/
RewriteRule ^(.*)$ index.php/%1/$1 [L]
# Handle subdomains
RewriteCond %{SERVER_NAME} ^([a-z0-9-]+)\.mydomain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/%1/$1 [L]