Make domain name point to specific journal

I have OJS installed and 2 journals hosted.

The domains we would like to work are as follows:
main domain is the one that shows the list of all hosted journals and how we get to admin (this works fine)
separate domain that we would like to point to a specific journal (problems)

the main domain works as intended and everything works fine. It is on the domain that is named after the journal that causes us grief. That one will work, but it will not load the css and any images.

Our setup is OJS in IIS. It was setup by a former webmaster who is no longer here. My web skills are limited, as it is not where I spend my time. I have url-rewrite plugin for the redirect, but I am sure there is something that I have left out of my rule.

So that I don’t muddy the waters with unnecessary information, please let me know what I can tell you about what I have done and I will reply.

Thanks,
Paul

This configuration is a combination of:

  1. Setting a base_url[] override for the journal in config.inc.php with the domain name for that journal.
  2. Setting up a virtual host in IIS which listens on that domain name.
  3. Configuring that virtual host to rewrite incoming requests to OJS.

It is probably that third step which is causing your trouble. We have some examples involving RESTful URLs and discussion on doing this in mod_rewrite under Apache, but I’m not aware of published examples under IIS. In IIS it would (I think) be part of the web.config, exposed as a <rule> with a <match url="...">, some <conditions> and an <action type="rewrite" url="...">.

So, I have setup a virtual host now in IIS so that it listens on journal.url and I have also set the

config.inc.php file

This is the override section
base_url[index] = http://frontpage.of.our.ojs
base_url[journal] = http://journal.url

This is the web.config I have.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="journal" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^(www.)?journal.url$" /> </conditions> <action type="Rewrite" url="/index.php/journal" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

The behavior that I am seeing is that it correctly points to the journal page, which is desired, but it seems that all images and formatting are still not working. When I click on the view journal link on the main page of OJS it works fine. Again, I am a little out of my element, so I am slower to understand. Am I close and just have a small issue at this point?

Thanks

It looks like you are close, but need to exclude static files from your rewrite request.

The mod_rewrite lines are:

   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f

That says, “only do the re-write if the request is not a known file or directory”.

so, now my web.config looks like this:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="journal" enabled="true" stopProcessing="true"> <match url="^.*$" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(www.)?journal.url$" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" /> </conditions> <action type="Rewrite" url="/index.php/journal" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

From what I can find, those are the IIS equivalent of the 2 lines you gave me above (although I am not sure that I have the IsDirectory/IsFile correct, as it might need to be IsNotDirectory in IIS. I still have something a little off, though, as now, it drops me back off at the front page of OJS and the image up top is broken, but the formatting is otherwise correct.

Is there a specific order that these need to be in? Also, it gives me the option of match any or match all. I assume that I would need to match any.

I’m not directly familiar with IIS configuration - you might need to try a different forum for that.

I can say, however, that the above logic looks wrong… the “MatchAny” sounds like an “OR” condition, and the matchType of “IsDirectory” or “IsFile” sounds like you’re matching files and directories, when you want to be excluding files and directories on the match.

The general logic is:
If the URL is NOT a file
and
If the URL is NOT a directory
Then
Take the incoming URL and map it against OJS’s index.php with the journal name as a RESTful parameter.