I have already tried copying different mod rewrite conditions and I have also already set the following in the config file:
base_url[‘index’] = aghamx.com
base_url[‘aghamx’] = http://www.aghamx.com
restful_urls = On
But unfortunately, it ends up with redirect loops or incorrect display.
If you just have a single journal within your installation, it is far easier to just set the “Journal Redirect” in the Site Configuration than to create a custom mod_rewrite solution. This would allow a user who enters www.aghamx.com to be gracefully redirected to www.aghamx.com/index.php/aghamx. (Or with minimal mod_rewrite configuration, to www.aghamx.com/aghamx.)
If you are committed to “inverting” the site and journal structure (as described in the other post), please share your mod_rewrite configuration here, and we can try to offer some suggestions.
May I request your help with this. Also, it would be really helpful to be able to easily achieve this in the future since single journals in root urls should be common. Thanks a lot.
The best solution for single journals in root URLs is the “Journal redirect” within site settings. This provides a “one click” setting to make the site homepage redirect to the journal homepage, with no fancy intervention with the base_urls and mod_rewrite rules.
Regarding your current config, your .htaccess file seems to reference a subdomain of “aghmx.aghamx.com”, but this isn’t referenced anywhere in your config.inc.php base_urls. Is this intentional? Your rewrites will substantially depend on whether you want the side index on the same domain (or subdomain) as the journal, or on a different domain (or subdomain).
Btw, as of now, redirecting to the aghamx journal is not an issue (if I’m not mistaken). Entering www.aghamx.com automatically redirects to aghamx.com/index.php/aghamx.
What I really wanted to do is more like cleaning the URL by eliminating index.php/aghamx so that all subdirectories would just appear as www.aghamx.com/* instead of www.aghamx.com/index.php/aghamx/*
I’m finding it hard to understand how mod rewrite works and I just followed a thread from the forum with the same problems. I’ve read these threads
You said here that
There is no mechanism in the software to create vanity URLs which automatically strip the RESTful context from pages, but you can create the URL rewrites by adding additional mod_rewrite rules, and then when adding links in the menu or in HTML you would need to manually reference those links. The pages would still be available at their original URI, and could be indexed as such if these links are crawled. I think this would get you 90% of the way there, though I think it would be a lot of effort for minimal benefit.
I now changed the lines into:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.aghamx.com$
RewriteRule ^$ http://www.aghamx.com/index [L,R=301]
did not work still. too many redirects
It looks like you do not have full administrator privileges on your install. Do you have access to the admin account? There should be a Site Settings option if you have administrator privileges.
I would recommend a install of OJS is the document root of www.aghamx.com, with a simple mod_rewrite to strip off the index.php, enabling restful_urls. Use the Journal Redirect to go to your journal automatically.
This would require no custom base_url overrides. It would give your journal a base url of http://www.aghamx.com/aghamx. Any access to http://www.aghamx.com would automatically redirect to http://www.aghamx.com/aghamx. Your site management would be accessible at http://www.aghamx.com/index.
(But note that this rule will still depend on your specific server configuration!)
If you really only ever intend to host the one journal, you might be able to improve the URL by using a journal shortname of “journal” or “pubs” or similar, for a journal URL of http://www.aghamx.com/pubs/, so “aghamx” does not repeat in the URL.
If you need to get the journal’s root down to the domain route, this is possible, but it really does require special expertise with mod_rewrite and is extremely situation dependent.
I thought I was using the admin account because it was the account I entered during the first installation. I don’t know how I don’t seem to have admin privileges. In order to make sure I had not made an error somewhere during the installation, I did a fresh installation in localhost, entered a new account, then immediately tried to navigate to the site settings but also found none. I navigated to the role settings and it is indicated that the account Im using (which I created during installation and should be the site admin), is journal manager. I think this is exactly the same case happening in the live website. What do you think might be wrong? How could I get those admin privileges? Hopefully without doing a fresh installation in the web server…
Btw, I tried the mod rewrite rule you suggested but still without success. Maybe it would work once the journal redirect settings are corrected.
Also, I think that’s a really good solution, I will be setting the journal URL to www.aghamx.com/journal so the remaining concern would only removing index.php.
Thank you for the support! Hopefully this gets fully resolved soon!
What specific version of OJS are you using (including the last “dot release”)? When you tried a clean install on localhost, did you have the installer create a new database, or did you already have a database?
I’m using 3.0.1. Oh yes, about that, I could not create a new database and the installation could not proceed. I just did the installation in localhost yet again to make sure. And now I remember that I’ve been getting “A database error has occurred: Access denied for user…”
Only way I could resolve it was create a new database in phpmyadmin in hostgator cpanel and then created a new user and elevated its privileges to that database. And then I entered the database and the user to the OJS Installation and OJS installation was successful… hmmm… Could this be the reason?
I would be primarily concerned about installing “over top” of an existing database. If you have a blank database created in phpmyadmin which the OJS install populates, or if you have the installer create the database, I would expect the user your specify in the installation form to get full admin privileges.
I replicated the problem of the Site Settings not displaying in 3.0.1 and 3.0.2. I was able (in 3.0.2) to manually enter the URL of “index.php/index/admin/settings” and to pull up and to save the Site Settings as the administrator. Manual access to index.php/index/admin/settings is inconclusive. I’ve found the Site Settings will only show if more than one journal is defined. I’m going to gather a bit more information and then file a bug report.
Changing this to DirectoryIndex index.php allowed OJS to behave as expected, with the Site index automatically redirecting to the Journal index for a single journal install.
They say: the next RewriteRule applies only to requests which don’t start with any character, followed immediately by the literal “/index.php/”, and ending exactly in one character. Then, for any request that matches that and starts exactly with “/aghamx/” followed by any captured characters, redirect the request to index.php under the aghamx folder, with the captured characters apended.